home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / samba / patches / samba-1.040 / samba-1
Encoding:
Text File  |  1995-11-22  |  66.8 KB  |  2,302 lines

  1. diff -u -r --new-file last-version/docs/BROWSING.txt samba-1.9.15p3/docs/BROWSING.txt
  2. --- last-version/docs/BROWSING.txt    Tue Nov 21 12:46:25 1995
  3. +++ samba-1.9.15p3/docs/BROWSING.txt    Wed Nov 22 22:07:16 1995
  4. @@ -87,11 +87,41 @@
  5.  elections to just about anyone else.
  6.  
  7.  If you want Samba to win elections then just set the "os level" global
  8. -option in smb.conf to a higher number. It defaults to 0. Using 3 would
  9. -make it win all elections over every other system (except other samba
  10. -systems!) 
  11. +option in smb.conf to a higher number. It defaults to 0. Using 33
  12. +would make it win all elections over every other system (except other
  13. +samba systems!)
  14.  
  15. -A "os level" of 2 would make it beat WfWg and Win95, but not NTAS.
  16. +A "os level" of 2 would make it beat WfWg and Win95, but not NTAS. A
  17. +NTAS domain controller uses level 32.
  18. +
  19. +The maximum os level is 255
  20. +
  21. +MAKING SAMBA THE DOMAIN MASTER
  22. +==============================
  23. +
  24. +The domain master is responsible for collating the browse lists of
  25. +multiple subnets so that browsing can occur between subnets. You can
  26. +make samba act as the domain master by setting "domain master = yes"
  27. +in smb.conf. By default it will not be a domain master.
  28. +
  29. +When samba is the domain master and the master browser it will listen
  30. +for master announcements from other subnets and then contact them to
  31. +synchronise browse lists.
  32. +
  33. +If you want samba to be the domain master then I suggest you also set
  34. +the "os level" high enough to make sure it wins elections.
  35. +
  36. +NOTIFYING THE DOMAIN CONTROLLER
  37. +===============================
  38. +
  39. +If you have a domain controller for the domain which Samba is a part
  40. +of then you should add the line "domain controller = address" to
  41. +smb.conf. "address" can either be a name available via DNS or a IP
  42. +address or a broadcast address. If it is a broadcast address then
  43. +Samba will look for a domain controller on that network.
  44. +
  45. +When Samba is the master browser it will regularly contact the domain
  46. +controller to synchronise browse lists.
  47.  
  48.  
  49.  NOTE ABOUT BROADCAST ADDRESSES
  50. diff -u -r --new-file last-version/docs/smb.conf.5 samba-1.9.15p3/docs/smb.conf.5
  51. --- last-version/docs/smb.conf.5    Tue Nov 14 22:47:42 1995
  52. +++ samba-1.9.15p3/docs/smb.conf.5    Wed Nov 22 10:30:40 1995
  53. @@ -435,6 +435,8 @@
  54.  
  55.  allow hosts
  56.  
  57. +alternate permissions
  58. +
  59.  available
  60.  
  61.  browseable
  62. @@ -557,6 +559,8 @@
  63.  
  64.  valid users
  65.  
  66. +volume
  67. +
  68.  wide links
  69.  
  70.  writable
  71. @@ -649,6 +653,26 @@
  72.  
  73.  .B Example:
  74.       allow hosts = 150.203.5. myhost.mynet.edu.au
  75. +
  76. +.SS alternate permissions (S)
  77. +
  78. +This option affects the way the "read only" DOS attribute is produced
  79. +for unix files. If this is false then the read only bit is set for
  80. +files on writeable shares which the user cannot write to.
  81. +
  82. +If this is true then it is set for files whos user write bit is not set.
  83. +
  84. +The latter behaviour of useful for when users copy files from each
  85. +others directories, and use a file manager that preserves
  86. +permissions. Without this option they may get annoyed as all copied
  87. +files will have the "read only" bit set.
  88. +
  89. +.B Default:
  90. +    alternate permissions = no
  91. +
  92. +.B Example:
  93. +    alternate permissions = yes
  94. +
  95.  .SS available (S)
  96.  This parameter lets you 'turn off' a service. If 'available = no', then
  97.  ALL attempts to connect to the service will fail. Such failures are logged.
  98. @@ -2421,6 +2445,13 @@
  99.  
  100.  .B Example
  101.      valid users = greg, @pcusers
  102. +
  103. +.SS volume (S)
  104. +This allows you to override the volume label returned for a
  105. +share. Useful for CDROMs whos installation programs insist on a
  106. +particular volume label.
  107. +
  108. +The default is the name of the share
  109.  
  110.  .SS wide links (S)
  111.  This parameter controls whether or not links in the Unix file system may be
  112. diff -u -r --new-file last-version/source/Makefile samba-1.9.15p3/source/Makefile
  113. --- last-version/source/Makefile    Tue Nov 21 11:27:50 1995
  114. +++ samba-1.9.15p3/source/Makefile    Wed Nov 22 17:50:54 1995
  115. @@ -462,13 +462,13 @@
  116.      @echo Linking smbrun
  117.      @$(CC) $(CFLAGS) -o smbrun smbrun.o $(LIBS)
  118.  
  119. -nmblookup: nmblookup.o $(UTILOBJ)  
  120. +nmblookup: nmblookup.o nmblib.o $(UTILOBJ)  
  121.      @echo Linking nmblookup
  122.      @$(CC) $(CFLAGS) -o nmblookup nmblookup.o nmblib.o $(UTILOBJ) $(LIBS)
  123.  
  124. -nmbd: nameserv.o nmblib.o $(UTILOBJ) 
  125. +nmbd: nameserv.o nmblib.o nmbsync.o $(UTILOBJ) 
  126.      @echo Linking nmbd
  127. -    @$(CC) $(CFLAGS) -o nmbd nameserv.o nmblib.o $(PARAMOBJ) $(LIBS)
  128. +    @$(CC) $(CFLAGS) -o nmbd nameserv.o nmblib.o nmbsync.o $(PARAMOBJ) $(LIBS)
  129.  
  130.  smbclient: client.o clitar.o getsmbpass.o $(UTILOBJ) 
  131.      @echo Linking smbclient
  132. diff -u -r --new-file last-version/source/change-log samba-1.9.15p3/source/change-log
  133. --- last-version/source/change-log    Tue Nov 21 12:50:13 1995
  134. +++ samba-1.9.15p3/source/change-log    Wed Nov 22 22:04:02 1995
  135. @@ -1676,10 +1676,25 @@
  136.      - added SMBcopy
  137.      - added "max ttl" option
  138.      - arch detection patch from Bas Laarhoven <bas@vimec.nl>
  139. +    - released p2
  140. +    - another OS/2 fix - the level 4 getpathinfo for EAs
  141. +    - added "alternate permissions" option
  142. +    - changed client to parse destination names into name + domain
  143. +    - fixed problem with PrimaryGroup and lmhosts loading
  144. +    - added domain master ability to nmbd
  145. +    - added "domain master" option
  146. +    - added "domain controller" option and code
  147. +    - pwd fix to client from Erik Devriendt (de@te6.siemens.be)
  148. +    - fixed problem in smbmv that led to ar not working in mks
  149. +    - added transs2
  150. +    - released p3
  151.  
  152. +
  153.  ==========
  154.  todo:
  155.  
  156. +drag long filename to samba under os/2 gives short name
  157. +
  158.  document max ttl option
  159.  
  160.  dup/close 0 for getopt?
  161. @@ -1721,6 +1736,7 @@
  162.  
  163.  weird foooooooo/open.exe bug on NT
  164.  
  165. +%a detection can't detect Win95
  166.  
  167.  lpd stuff:
  168.   Tony Aiuto  (tony@ics.com)
  169. diff -u -r --new-file last-version/source/client.c samba-1.9.15p3/source/client.c
  170. --- last-version/source/client.c    Mon Nov 20 18:54:04 1995
  171. +++ samba-1.9.15p3/source/client.c    Wed Nov 22 20:43:21 1995
  172. @@ -46,6 +46,7 @@
  173.  #define SHORT_TIMEOUT (5*1000)
  174.  
  175.  int name_type = 0x20;
  176. +
  177.  int max_protocol = PROTOCOL_NT1;
  178.  
  179.  
  180. @@ -111,6 +112,9 @@
  181.  int put_total_size = 0;
  182.  int put_total_time_ms = 0;
  183.  
  184. +
  185. +extern int Client;
  186. +
  187.  #ifdef KANJI
  188.  extern int coding_system;
  189.  #define CNV_LANG(s) (coding_system == DOSV_CODE?s:dos_to_unix(s, False))
  190. @@ -256,8 +260,8 @@
  191.    *p++ = 4;
  192.    strcpy(p,path2);
  193.  
  194. -  send_smb(outbuf);
  195. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  196. +  send_smb(Client,outbuf);
  197. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  198.  
  199.    if (report && CVAL(inbuf,smb_rcls) != 0)
  200.      DEBUG(2,("chkpath: %s\n",smb_errstr(inbuf)));
  201. @@ -292,10 +296,10 @@
  202.  
  203.    set_message(outbuf,0,PTR_DIFF(p,smb_buf(outbuf)),False);
  204.  
  205. -  send_smb(outbuf);
  206. +  send_smb(Client,outbuf);
  207.    
  208.  
  209. -  if (!receive_smb(inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
  210. +  if (!receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
  211.      {
  212.        printf("SMBsendstrt failed. (%s)\n",smb_errstr(inbuf));
  213.        return;
  214. @@ -332,10 +336,10 @@
  215.        SSVAL(p,1,l);
  216.        memcpy(p+3,msg,l);
  217.  
  218. -      send_smb(outbuf);
  219. +      send_smb(Client,outbuf);
  220.        
  221.  
  222. -      if (!receive_smb(inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
  223. +      if (!receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
  224.      {
  225.        printf("SMBsendtxt failed (%s)\n",smb_errstr(inbuf));
  226.        return;
  227. @@ -355,10 +359,10 @@
  228.    set_message(outbuf,1,0,False);
  229.    SSVAL(outbuf,smb_vwv0,grp_id);
  230.  
  231. -  send_smb(outbuf);
  232. +  send_smb(Client,outbuf);
  233.    
  234.  
  235. -  if (!receive_smb(inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
  236. +  if (!receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
  237.      {
  238.        printf("SMBsendend failed (%s)\n",smb_errstr(inbuf));
  239.        return;
  240. @@ -380,8 +384,8 @@
  241.    SSVAL(outbuf,smb_tid,cnum);
  242.    setup_pkt(outbuf);
  243.  
  244. -  send_smb(outbuf);
  245. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  246. +  send_smb(Client,outbuf);
  247. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  248.  
  249.    if (CVAL(inbuf,smb_rcls) != 0) 
  250.      DEBUG(0,("Error in dskattr: %s\n",smb_errstr(inbuf)));      
  251. @@ -397,7 +401,8 @@
  252.  ****************************************************************************/
  253.  static void cmd_pwd(void)
  254.  {
  255. -  DEBUG(0,("Current directory is %s%s\n",CNV_LANG(service),CNV_LANG(cur_dir)));
  256. +  DEBUG(0,("Current directory is %s",CNV_LANG(service)));
  257. +  DEBUG(0,("%s\n",CNV_LANG(cur_dir)));
  258.  }
  259.  
  260.  
  261. @@ -714,8 +719,8 @@
  262.        memcpy(p,status,21);
  263.      }
  264.  
  265. -      send_smb(outbuf);
  266. -      receive_smb(inbuf,CLIENT_TIMEOUT);
  267. +      send_smb(Client,outbuf);
  268. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  269.  
  270.        received = SVAL(inbuf,smb_vwv0);
  271.  
  272. @@ -764,8 +769,8 @@
  273.        p += 2;
  274.        memcpy(p,status,21);
  275.  
  276. -      send_smb(outbuf);
  277. -      receive_smb(inbuf,CLIENT_TIMEOUT,False);
  278. +      send_smb(Client,outbuf);
  279. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT,False);
  280.  
  281.        if (CVAL(inbuf,smb_rcls) != 0) 
  282.      DEBUG(0,("Error closing search: %s\n",smb_errstr(inbuf)));      
  283. @@ -800,7 +805,7 @@
  284.  
  285.    *data_len = *param_len = 0;
  286.  
  287. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  288. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  289.  
  290.    if (CVAL(inbuf,smb_rcls) != 0)
  291.      return(False);
  292. @@ -828,7 +833,7 @@
  293.  
  294.        if (total_data <= *data_len && total_param <= *param_len)
  295.      break;
  296. -      receive_smb(inbuf,CLIENT_TIMEOUT);
  297. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  298.      }
  299.    
  300.    return(True);
  301. @@ -927,7 +932,7 @@
  302.        *p++ = 0; *p++ = 0;
  303.      }
  304.  
  305. -      send_smb(outbuf);
  306. +      send_smb(Client,outbuf);
  307.  
  308.        receive_trans2_response(inbuf,
  309.                    &resp_data_len,&resp_param_len,
  310. @@ -1153,8 +1158,8 @@
  311.        return;
  312.      }
  313.  
  314. -  send_smb(outbuf);
  315. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  316. +  send_smb(Client,outbuf);
  317. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  318.  
  319.    if (CVAL(inbuf,smb_rcls) != 0)
  320.      {
  321. @@ -1280,8 +1285,8 @@
  322.            smb_setlen(outbuf,smb_len(outbuf)+9);
  323.          }
  324.        
  325. -      send_smb(outbuf);
  326. -      receive_smb(inbuf,CLIENT_TIMEOUT);
  327. +      send_smb(Client,outbuf);
  328. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  329.        
  330.        if (CVAL(inbuf,smb_rcls) != 0)
  331.          {
  332. @@ -1320,7 +1325,7 @@
  333.          SSVAL(outbuf,smb_vwv3,MIN(finfo.size-nread,readbraw_size));
  334.          SSVAL(outbuf,smb_vwv4,0);
  335.          SIVALS(outbuf,smb_vwv5,-1);
  336. -        send_smb(outbuf);
  337. +        send_smb(Client,outbuf);
  338.  
  339.          /* Now read the raw data into the buffer and write it */      
  340.          if(read_smb_length(Client,inbuf,0) == -1) {
  341. @@ -1377,8 +1382,8 @@
  342.        SIVAL(outbuf,smb_vwv2,nread);
  343.        SSVAL(outbuf,smb_vwv4,finfo.size - nread);
  344.  
  345. -      send_smb(outbuf);
  346. -      receive_smb(inbuf,CLIENT_TIMEOUT);
  347. +      send_smb(Client,outbuf);
  348. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  349.  
  350.        if (CVAL(inbuf,smb_rcls) != 0)
  351.          {
  352. @@ -1421,8 +1426,8 @@
  353.        SSVAL(outbuf,smb_vwv0,fnum);
  354.        SIVALS(outbuf,smb_vwv1,-1);
  355.        
  356. -      send_smb(outbuf);
  357. -      receive_smb(inbuf,CLIENT_TIMEOUT);
  358. +      send_smb(Client,outbuf);
  359. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  360.        
  361.        if (!ignore_close_error && CVAL(inbuf,smb_rcls) != 0)
  362.      {
  363. @@ -1451,8 +1456,8 @@
  364.      p += strlen(p)+1;
  365.      *p++ = 4;
  366.      *p = 0;
  367. -    send_smb(outbuf);
  368. -    receive_smb(inbuf,CLIENT_TIMEOUT);
  369. +    send_smb(Client,outbuf);
  370. +    receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  371.    }
  372.  
  373.    {
  374. @@ -1684,8 +1689,8 @@
  375.    *p++ = 4;      
  376.    strcpy(p,name);
  377.    
  378. -  send_smb(outbuf);
  379. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  380. +  send_smb(Client,outbuf);
  381. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  382.    
  383.    if (CVAL(inbuf,smb_rcls) != 0)
  384.      {
  385. @@ -1766,9 +1771,9 @@
  386.    SIVAL(outbuf,smb_vwv3,pos);
  387.    SSVAL(outbuf,smb_vwv7,1);
  388.  
  389. -  send_smb(outbuf);
  390. +  send_smb(Client,outbuf);
  391.    
  392. -  if (!receive_smb(inbuf,CLIENT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
  393. +  if (!receive_smb(Client,inbuf,CLIENT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
  394.      return(0);
  395.  
  396.    _smb_setlen(buf-4,n);        /* HACK! XXXX */
  397. @@ -1776,7 +1781,7 @@
  398.    if (write_socket(Client,buf-4,n+4) != n+4)
  399.      return(0);
  400.  
  401. -  if (!receive_smb(inbuf,CLIENT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0) {
  402. +  if (!receive_smb(Client,inbuf,CLIENT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0) {
  403.      DEBUG(0,("Error writing remote file (2)\n"));
  404.      return(0);
  405.    }
  406. @@ -1812,8 +1817,8 @@
  407.  
  408.    memcpy(smb_buf(outbuf)+3,buf,n);
  409.  
  410. -  send_smb(outbuf);
  411. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  412. +  send_smb(Client,outbuf);
  413. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  414.  
  415.    if (CVAL(inbuf,smb_rcls) != 0) {
  416.      DEBUG(0,("%s writing remote file\n",smb_errstr(inbuf)));
  417. @@ -1867,8 +1872,8 @@
  418.    *p++ = 4;      
  419.    strcpy(p,rname);
  420.    
  421. -  send_smb(outbuf);
  422. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  423. +  send_smb(Client,outbuf);
  424. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  425.    
  426.    if (CVAL(inbuf,smb_rcls) != 0)
  427.      {
  428. @@ -1939,8 +1944,8 @@
  429.    SSVAL(outbuf,smb_vwv0,fnum);  
  430.    put_dos_date3(outbuf,smb_vwv1,close_time);
  431.  
  432. -  send_smb(outbuf);
  433. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  434. +  send_smb(Client,outbuf);
  435. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  436.    
  437.    if (CVAL(inbuf,smb_rcls) != 0)
  438.      {
  439. @@ -2233,7 +2238,7 @@
  440.    SSVAL(outbuf,smb_tpscnt,6 + strlen(fname)+1);
  441.    SSVAL(outbuf,smb_tdscnt,0);
  442.    SSVAL(outbuf,smb_mprcnt,2); 
  443. -  SSVAL(outbuf,smb_mdrcnt,26);
  444. +  SSVAL(outbuf,smb_mdrcnt,65535);
  445.    SSVAL(outbuf,smb_msrcnt,0);
  446.    SSVAL(outbuf,smb_flags,0); 
  447.    SIVAL(outbuf,smb_timeout,0);
  448. @@ -2249,12 +2254,12 @@
  449.    *p++ = 0;            /* put in a null smb_name */
  450.    *p++ = 'D'; *p++ = ' ';    /* this was added because OS/2 does it */
  451.  
  452. -  SSVAL(p,0,2); /* level */
  453. +  SSVAL(p,0,4); /* level */
  454.    p += 6;
  455.    strcpy(p,fname);
  456.    p = skip_string(p,1);
  457.  
  458. -  send_smb(outbuf);
  459. +  send_smb(Client,outbuf);
  460.  
  461.    receive_trans2_response(inbuf,
  462.                &resp_data_len,&resp_param_len,
  463. @@ -2323,8 +2328,8 @@
  464.    *p++ = 4;      
  465.    strcpy(p,rname);
  466.    
  467. -  send_smb(outbuf);
  468. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  469. +  send_smb(Client,outbuf);
  470. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  471.    
  472.    if (CVAL(inbuf,smb_rcls) != 0)
  473.      {
  474. @@ -2377,8 +2382,8 @@
  475.        CVAL(smb_buf(outbuf),0) = 1;
  476.        SSVAL(smb_buf(outbuf),1,n);
  477.  
  478. -      send_smb(outbuf);
  479. -      receive_smb(inbuf,CLIENT_TIMEOUT);
  480. +      send_smb(Client,outbuf);
  481. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  482.  
  483.        if (CVAL(inbuf,smb_rcls) != 0)
  484.      {
  485. @@ -2399,8 +2404,8 @@
  486.  
  487.    SSVAL(outbuf,smb_vwv0,fnum);
  488.  
  489. -  send_smb(outbuf);
  490. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  491. +  send_smb(Client,outbuf);
  492. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  493.    
  494.    if (CVAL(inbuf,smb_rcls) != 0)
  495.      {
  496. @@ -2432,8 +2437,8 @@
  497.    SSVAL(outbuf,smb_vwv0,32); /* a max of 20 entries is to be shown */
  498.    SSVAL(outbuf,smb_vwv1,0); /* the index into the queue */
  499.    
  500. -  send_smb(outbuf);
  501. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  502. +  send_smb(Client,outbuf);
  503. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  504.    
  505.    if (CVAL(inbuf,smb_rcls) != 0)
  506.      {
  507. @@ -2513,8 +2518,8 @@
  508.    *p++ = 4;      
  509.    strcpy(p,mask);
  510.    
  511. -  send_smb(outbuf);
  512. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  513. +  send_smb(Client,outbuf);
  514. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  515.    
  516.    if (CVAL(inbuf,smb_rcls) != 0)
  517.      DEBUG(0,("%s deleting remote file %s\n",smb_errstr(inbuf),CNV_LANG(mask)));
  518. @@ -2578,8 +2583,8 @@
  519.    *p++ = 4;      
  520.    strcpy(p,mask);
  521.    
  522. -  send_smb(outbuf);
  523. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  524. +  send_smb(Client,outbuf);
  525. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  526.    
  527.    if (CVAL(inbuf,smb_rcls) != 0)
  528.      {
  529. @@ -2624,8 +2629,8 @@
  530.    *p++ = 4;      
  531.    strcpy(p,dest);
  532.    
  533. -  send_smb(outbuf);
  534. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  535. +  send_smb(Client,outbuf);
  536. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  537.    
  538.    if (CVAL(inbuf,smb_rcls) != 0)
  539.      {
  540. @@ -2770,13 +2775,18 @@
  541.  ****************************************************************************/
  542.  static BOOL send_session_request(char *inbuf,char *outbuf)
  543.  {
  544. +  fstring dest;
  545.    char *p;
  546.    int len = 4;
  547.    /* send a session request (RFC 8002) */
  548.  
  549. +  strcpy(dest,desthost);
  550. +  p = strchr(dest,'.');
  551. +  if (p) *p = 0;
  552. +
  553.    /* put in the destination name */
  554.    p = outbuf+len;
  555. -  name_mangle(desthost,p,name_type);
  556. +  name_mangle(dest,p,name_type);
  557.    len += name_len(p);
  558.  
  559.    /* and my name */
  560. @@ -2788,10 +2798,10 @@
  561.    _smb_setlen(outbuf,len);
  562.    CVAL(outbuf,0) = 0x81;
  563.  
  564. -  send_smb(outbuf);
  565. +  send_smb(Client,outbuf);
  566.    DEBUG(5,("Sent session request\n"));
  567.  
  568. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  569. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  570.  
  571.    if (CVAL(inbuf,0) == 0x84) /* C. Hoch  9/14/95 Start */
  572.      {
  573. @@ -2946,8 +2956,8 @@
  574.  
  575.    CVAL(smb_buf(outbuf),0) = 2;
  576.  
  577. -  send_smb(outbuf);
  578. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  579. +  send_smb(Client,outbuf);
  580. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  581.  
  582.    show_msg(inbuf);
  583.  
  584. @@ -3086,8 +3096,8 @@
  585.      set_message(outbuf,13,PTR_DIFF(p,smb_buf(outbuf)),False);
  586.        }
  587.  
  588. -      send_smb(outbuf);
  589. -      receive_smb(inbuf,CLIENT_TIMEOUT);
  590. +      send_smb(Client,outbuf);
  591. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  592.  
  593.        show_msg(inbuf);
  594.  
  595. @@ -3178,8 +3188,8 @@
  596.      strcpy(p,dev);
  597.    }
  598.  
  599. -  send_smb(outbuf);
  600. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  601. +  send_smb(Client,outbuf);
  602. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  603.  
  604.    /* trying again with a blank password */
  605.    if (CVAL(inbuf,smb_rcls) != 0 && 
  606. @@ -3236,8 +3246,8 @@
  607.    SSVAL(outbuf,smb_tid,cnum);
  608.    setup_pkt(outbuf);
  609.  
  610. -  send_smb(outbuf);
  611. -  receive_smb(inbuf,SHORT_TIMEOUT);
  612. +  send_smb(Client,outbuf);
  613. +  receive_smb(Client,inbuf,SHORT_TIMEOUT);
  614.  
  615.    if (CVAL(inbuf,smb_rcls) != 0)
  616.      {
  617. @@ -3300,8 +3310,8 @@
  618.  
  619.    set_message(outbuf,14,PTR_DIFF(p2+drcnt,smb_buf(outbuf)),False);
  620.  
  621. -  send_smb(outbuf);
  622. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  623. +  send_smb(Client,outbuf);
  624. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  625.  
  626.    if (CVAL(inbuf,smb_rcls) == 0)
  627.      {
  628. @@ -3455,11 +3465,7 @@
  629.  {
  630.    char *p,*rparam,*rdata;
  631.    pstring param;
  632. -#if 0
  633. -  int uLevel = atoi(getenv("XX_ULEVEL"));
  634. -#else
  635.    int uLevel = 1;
  636. -#endif
  637.  
  638.    int servertype = SV_TYPE_ALL; 
  639.  
  640. @@ -3724,7 +3730,7 @@
  641.        }
  642.  #endif
  643.        if (FD_ISSET(Client,&fds))
  644. -      receive_smb(buffer,0);
  645. +      receive_smb(Client,buffer,0);
  646.        
  647.  #ifdef CLIX
  648.        delay++;
  649. @@ -3758,8 +3764,8 @@
  650.    SSVAL(outbuf,smb_tid,cnum);
  651.    setup_pkt(outbuf);
  652.  
  653. -  send_smb(outbuf);
  654. -  receive_smb(inbuf,SHORT_TIMEOUT);
  655. +  send_smb(Client,outbuf);
  656. +  receive_smb(Client,inbuf,SHORT_TIMEOUT);
  657.  
  658.    close_sockets();
  659.    if (!open_sockets(0)) return(False);
  660. diff -u -r --new-file last-version/source/clitar.c samba-1.9.15p3/source/clitar.c
  661. --- last-version/source/clitar.c    Mon Nov  6 16:17:43 1995
  662. +++ samba-1.9.15p3/source/clitar.c    Wed Nov 22 15:05:30 1995
  663. @@ -31,6 +31,7 @@
  664.  
  665.  #define SEPARATORS " \t\n\r"
  666.  extern int DEBUGLEVEL;
  667. +extern int Client;
  668.  
  669.  /* These defines are for the do_setrattr routine, to indicate
  670.   * setting and reseting of file attributes in the function call */
  671. @@ -293,8 +294,8 @@
  672.    *p++ = 4;
  673.    *p++ = 0;
  674.  
  675. -  send_smb(outbuf);
  676. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  677. +  send_smb(Client,outbuf);
  678. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  679.  
  680.    if (CVAL(inbuf,smb_rcls) != 0)
  681.      DEBUG(5,("getatr: %s\n",smb_errstr(inbuf)));
  682. @@ -331,8 +332,8 @@
  683.    *p++ = 4;
  684.    *p++ = 0;
  685.  
  686. -  send_smb(outbuf);
  687. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  688. +  send_smb(Client,outbuf);
  689. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  690.    
  691.    if (CVAL(inbuf,smb_rcls) != 0)
  692.      {
  693. @@ -417,8 +418,8 @@
  694.        smb_setlen(outbuf,smb_len(outbuf)+11*2+1);  
  695.      }
  696.    
  697. -  send_smb(outbuf);
  698. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  699. +  send_smb(Client,outbuf);
  700. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  701.  
  702.    if (CVAL(inbuf,smb_rcls) != 0)
  703.      {
  704. @@ -551,8 +552,8 @@
  705.            smb_setlen(outbuf,smb_len(outbuf)+9);
  706.          }
  707.            
  708. -          send_smb(outbuf);
  709. -          receive_smb(inbuf,CLIENT_TIMEOUT);
  710. +          send_smb(Client,outbuf);
  711. +          receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  712.            
  713.            if (CVAL(inbuf,smb_rcls) != 0)
  714.          {
  715. @@ -592,7 +593,7 @@
  716.          SSVAL(outbuf,smb_vwv3,MIN(finfo.size-nread,readbraw_size));
  717.          SSVAL(outbuf,smb_vwv4,0);
  718.          SIVALS(outbuf,smb_vwv5,-1);
  719. -        send_smb(outbuf);
  720. +        send_smb(Client,outbuf);
  721.          
  722.          /* Now read the raw data into the buffer and write it */      
  723.          if(read_smb_length(Client,inbuf,0) == -1) {
  724. @@ -649,8 +650,8 @@
  725.            SIVAL(outbuf,smb_vwv2,nread);
  726.            SSVAL(outbuf,smb_vwv4,finfo.size - nread);
  727.            
  728. -          send_smb(outbuf);
  729. -          receive_smb(inbuf,CLIENT_TIMEOUT);
  730. +          send_smb(Client,outbuf);
  731. +          receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  732.            
  733.            if (CVAL(inbuf,smb_rcls) != 0)
  734.          {
  735. @@ -701,8 +702,8 @@
  736.        SSVAL(outbuf,smb_vwv0,fnum);
  737.        SIVALS(outbuf,smb_vwv1,-1);
  738.        
  739. -      send_smb(outbuf);
  740. -      receive_smb(inbuf,CLIENT_TIMEOUT);
  741. +      send_smb(Client,outbuf);
  742. +      receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  743.        
  744.        if (!ignore_close_error && CVAL(inbuf,smb_rcls) != 0)
  745.      {
  746. @@ -928,8 +929,8 @@
  747.    *p++ = 4;      
  748.    strcpy(p,finfo.name);
  749.    
  750. -  send_smb(outbuf);
  751. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  752. +  send_smb(Client,outbuf);
  753. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  754.    
  755.    if (CVAL(inbuf,smb_rcls) != 0)
  756.      {
  757. @@ -965,8 +966,8 @@
  758.    CVAL(smb_buf(outbuf),0) = 1;
  759.    SSVAL(smb_buf(outbuf),1,n);
  760.  
  761. -  send_smb(outbuf); 
  762. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  763. +  send_smb(Client,outbuf); 
  764. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  765.    
  766.    if (CVAL(inbuf,smb_rcls) != 0)
  767.      {
  768. @@ -1001,8 +1002,8 @@
  769.         asctime(LocalTime(&finfo.mtime,GMT_TO_LOCAL)),
  770.         finfo.mtime));
  771.    
  772. -  send_smb(outbuf);
  773. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  774. +  send_smb(Client,outbuf);
  775. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  776.    
  777.    if (CVAL(inbuf,smb_rcls) != 0)
  778.      {
  779. @@ -1029,8 +1030,8 @@
  780.    *p++ = 4;
  781.    strcpy(p,fname);
  782.  
  783. -  send_smb(outbuf);
  784. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  785. +  send_smb(Client,outbuf);
  786. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  787.  
  788.    DEBUG(5,("smbchkpath: %s\n",smb_errstr(inbuf)));
  789.  
  790. @@ -1054,8 +1055,8 @@
  791.    *p++ = 4;      
  792.    strcpy(p,fname);
  793.    
  794. -  send_smb(outbuf);
  795. -  receive_smb(inbuf,CLIENT_TIMEOUT);
  796. +  send_smb(Client,outbuf);
  797. +  receive_smb(Client,inbuf,CLIENT_TIMEOUT);
  798.    
  799.    if (CVAL(inbuf,smb_rcls) != 0)
  800.      {
  801. diff -u -r --new-file last-version/source/getsmbpass.c samba-1.9.15p3/source/getsmbpass.c
  802. --- last-version/source/getsmbpass.c    Sat Nov 11 11:03:57 1995
  803. +++ samba-1.9.15p3/source/getsmbpass.c    Wed Nov 22 21:55:33 1995
  804. @@ -18,20 +18,9 @@
  805.  
  806.  /* Modified to use with samba by Jeremy Allison, 8th July 1995. */
  807.  
  808. -#ifdef SUNOS4
  809. -#define _sys_ioctl_h
  810. -#endif
  811. -
  812. -#ifdef SUNOS5
  813. -#define _SYS_IOCTL_H
  814. -#endif
  815. -
  816.  #include "includes.h"
  817.  
  818.  #ifdef REPLACE_GETPASS
  819. -
  820. -
  821. -#include <termios.h>
  822.  
  823.  #ifdef SYSV_TERMIO 
  824.  
  825. diff -u -r --new-file last-version/source/includes.h samba-1.9.15p3/source/includes.h
  826. --- last-version/source/includes.h    Tue Nov 14 22:10:06 1995
  827. +++ samba-1.9.15p3/source/includes.h    Wed Nov 22 21:55:27 1995
  828. @@ -217,6 +217,7 @@
  829.  #include <errno.h>
  830.  #include <sys/wait.h>
  831.  #include <signal.h>
  832. +#include <termios.h>
  833.  #ifdef sun386
  834.  #define NO_STRFTIME
  835.  #define NO_UTIMBUF
  836. @@ -245,6 +246,7 @@
  837.  #include <arpa/inet.h>
  838.  #include <rpcsvc/ypclnt.h>
  839.  #include <crypt.h> 
  840. +#include <termios.h>
  841.  extern int gettimeofday (struct timeval *, void *);
  842.  extern int gethostname (char *name, int namelen);
  843.  extern int innetgr (const char *, const char *, const char *, const char *);
  844. diff -u -r --new-file last-version/source/ipc.c samba-1.9.15p3/source/ipc.c
  845. --- last-version/source/ipc.c    Sat Nov 18 02:08:09 1995
  846. +++ samba-1.9.15p3/source/ipc.c    Wed Nov 22 21:08:05 1995
  847. @@ -65,6 +65,8 @@
  848.  #define SNLEN 15        /* service name length */
  849.  #define QNLEN 12        /* queue name maximum length */
  850.  
  851. +extern int Client;
  852. +
  853.  static int CopyExpanded(int cnum, int snum, char** dst, char* src, int* n)
  854.  {
  855.    pstring buf;
  856. @@ -157,7 +159,7 @@
  857.      SSVAL(outbuf,smb_vwv10+i*SIZEOFWORD,setup[i]);
  858.  
  859.    show_msg(outbuf);
  860. -  send_smb(outbuf);
  861. +  send_smb(Client,outbuf);
  862.  
  863.    tot_data = this_ldata;
  864.    tot_param = this_lparam;
  865. @@ -184,7 +186,7 @@
  866.        SSVAL(outbuf,smb_vwv9,0);
  867.  
  868.        show_msg(outbuf);
  869. -      send_smb(outbuf);
  870. +      send_smb(Client,outbuf);
  871.  
  872.        tot_data += this_ldata;
  873.        tot_param += this_lparam;
  874. @@ -1513,6 +1515,8 @@
  875.    char *p2;
  876.    int struct_len;
  877.  
  878. +  DEBUG(4,("NetServerGetInfo level %d\n",uLevel));
  879. +
  880.    /* check it's a supported varient */
  881.    if (!prefix_ok(str1,"WrLh")) return False;
  882.    switch( uLevel ) {
  883. @@ -1550,17 +1554,34 @@
  884.  
  885.    p = *rdata;
  886.    p2 = p + struct_len;
  887. -  if (uLevel != 20) StrnCpy(p,local_machine,16);
  888. +  if (uLevel != 20) {
  889. +    StrnCpy(p,local_machine,16);
  890. +    strupper(p);
  891. +  }
  892.    p += 16;
  893.    if (uLevel > 0)
  894.      {
  895. +      struct server_info_struct *servers=NULL;
  896. +      int i,count;
  897.        pstring comment;
  898. -      SCVAL(p,0,1);        /* version_major */
  899. -      SCVAL(p,1,9);        /* version_minor */
  900. -      SIVAL(p,2,SV_TYPE_WORKSTATION|SV_TYPE_SERVER|SV_TYPE_TIME_SOURCE
  901. -        /*|SV_TYPE_DOMAIN_CTRL*/); /* type */
  902. -      SIVAL(p,6,PTR_DIFF(p2,*rdata));
  903. +      uint32 servertype=SV_TYPE_SERVER_UNIX|SV_TYPE_WORKSTATION|
  904. +    SV_TYPE_SERVER|SV_TYPE_TIME_SOURCE;
  905. +
  906.        strcpy(comment,lp_serverstring());
  907. +
  908. +      if ((count=get_server_info(SV_TYPE_ALL,&servers))>0) {
  909. +    for (i=0;i<count;i++)
  910. +      if (strequal(servers[i].name,local_machine)) {
  911. +        servertype = servers[i].type;
  912. +        strcpy(comment,servers[i].comment);        
  913. +      }
  914. +      }
  915. +      if (servers) free(servers);
  916. +
  917. +      SCVAL(p,0,2);        /* version_major */
  918. +      SCVAL(p,1,0);        /* version_minor */
  919. +      SIVAL(p,2,servertype);
  920. +      SIVAL(p,6,PTR_DIFF(p2,*rdata));
  921.        standard_sub(cnum,comment);
  922.        StrnCpy(p2,comment,MAX(mdrcnt - struct_len,0));
  923.        p2 = skip_string(p2,1);
  924. @@ -1630,8 +1651,8 @@
  925.    p2 = skip_string(p2,1);
  926.    p += 4;
  927.  
  928. -  SCVAL(p,0,1); /* major version?? */
  929. -  SCVAL(p,1,9); /* minor version?? */
  930. +  SCVAL(p,0,2); /* major version?? */
  931. +  SCVAL(p,1,1); /* minor version?? */
  932.    p += 2;
  933.  
  934.    SIVAL(p,0,PTR_DIFF(p2,*rdata));
  935. @@ -2523,7 +2544,7 @@
  936.       of the parameter/data bytes */
  937.        outsize = set_message(outbuf,0,0,True);
  938.        show_msg(outbuf);
  939. -      send_smb(outbuf);
  940. +      send_smb(Client,outbuf);
  941.      }
  942.  
  943.    /* receive the rest of the trans packet */
  944. @@ -2531,7 +2552,7 @@
  945.      {
  946.        int pcnt,poff,dcnt,doff,pdisp,ddisp;
  947.  
  948. -      receive_smb(inbuf, 0);
  949. +      receive_smb(Client,inbuf, 0);
  950.        show_msg(inbuf);
  951.        
  952.        /* Ensure this is still a trans packet (sanity check) */
  953. diff -u -r --new-file last-version/source/loadparm.c samba-1.9.15p3/source/loadparm.c
  954. --- last-version/source/loadparm.c    Tue Nov 21 12:42:00 1995
  955. +++ samba-1.9.15p3/source/loadparm.c    Wed Nov 22 18:00:55 1995
  956. @@ -128,6 +128,7 @@
  957.     char *szSocketOptions;
  958.     char *szValidChars;
  959.     char *szWorkGroup;
  960. +   char *szDomainController;
  961.     char *szUsernameMap;
  962.     char *szCharacterSet;
  963.     int max_log_size;
  964. @@ -145,6 +146,7 @@
  965.     int os_level;
  966.     int max_ttl;
  967.     BOOL bPreferredMaster;
  968. +   BOOL bDomainMaster;
  969.     BOOL bEncryptPasswords;
  970.     BOOL bStripDot;
  971.     BOOL bNullPasswords;
  972. @@ -196,10 +198,12 @@
  973.    char *force_group;
  974.    char *readlist;
  975.    char *writelist;
  976. +  char *volume;
  977.    int  iMinPrintSpace;
  978.    int  iCreate_mode;
  979.    int  iMaxConnections;
  980.    int  iDefaultCase;
  981. +  BOOL bAlternatePerm;
  982.    BOOL bRevalidate;
  983.    BOOL bCaseSensitive;
  984.    BOOL bCasePreserve;
  985. @@ -265,10 +269,12 @@
  986.    NULL,    /* force group */
  987.    NULL,    /* readlist */
  988.    NULL,    /* writelist */
  989. +  NULL,    /* volume */
  990.    0,       /* iMinPrintSpace */
  991.    0755,    /* iCreate_mode */
  992.    0,       /* iMaxConnections */
  993.    CASE_LOWER, /* iDefaultCase */
  994. +  False,   /* bAlternatePerm */
  995.    False,   /* revalidate */
  996.    False,   /* case sensitive */
  997.    False,   /* case preserve */
  998. @@ -375,6 +381,7 @@
  999.    {"passwd chat",      P_STRING,  P_GLOBAL, &Globals.szPasswdChat,      NULL},
  1000.    {"valid chars",      P_STRING,  P_GLOBAL, &Globals.szValidChars,      handle_valid_chars},
  1001.    {"workgroup",        P_STRING,  P_GLOBAL, &Globals.szWorkGroup,       NULL},
  1002. +  {"domain controller",P_STRING,  P_GLOBAL, &Globals.szDomainController,NULL},
  1003.    {"username map",     P_STRING,  P_GLOBAL, &Globals.szUsernameMap,     NULL},
  1004.    {"character set",    P_STRING,  P_GLOBAL, &Globals.szCharacterSet,    handle_character_set},
  1005.    {"max log size",     P_INTEGER, P_GLOBAL, &Globals.max_log_size,      NULL},
  1006. @@ -394,6 +401,7 @@
  1007.    {"os level",         P_INTEGER, P_GLOBAL, &Globals.os_level,          NULL},
  1008.    {"max ttl",          P_INTEGER, P_GLOBAL, &Globals.max_ttl,           NULL},
  1009.    {"preferred master", P_BOOL,    P_GLOBAL, &Globals.bPreferredMaster,  NULL},
  1010. +  {"domain master",    P_BOOL,    P_GLOBAL, &Globals.bDomainMaster,     NULL},
  1011.  
  1012.    {"-valid",           P_BOOL,    P_LOCAL,  &sDefault.valid,            NULL},
  1013.    {"comment",          P_STRING,  P_LOCAL,  &sDefault.comment,          NULL},
  1014. @@ -404,6 +412,7 @@
  1015.    {"postexec",         P_STRING,  P_LOCAL,  &sDefault.szPostExec,       NULL},
  1016.    {"root preexec",     P_STRING,  P_LOCAL,  &sDefault.szRootPreExec,    NULL},
  1017.    {"root postexec",    P_STRING,  P_LOCAL,  &sDefault.szRootPostExec,   NULL},
  1018. +  {"alternate permissions",P_BOOL,P_LOCAL,  &sDefault.bAlternatePerm,   NULL},
  1019.    {"revalidate",       P_BOOL,    P_LOCAL,  &sDefault.bRevalidate,      NULL},
  1020.    {"default case",     P_INTEGER, P_LOCAL,  &sDefault.iDefaultCase,   handle_case},
  1021.    {"case sensitive",   P_BOOL,    P_LOCAL,  &sDefault.bCaseSensitive,   NULL},
  1022. @@ -426,6 +435,7 @@
  1023.    {"admin users",      P_STRING,  P_LOCAL,  &sDefault.szAdminUsers,     NULL},
  1024.    {"read list",        P_STRING,  P_LOCAL,  &sDefault.readlist,         NULL},
  1025.    {"write list",       P_STRING,  P_LOCAL,  &sDefault.writelist,        NULL},
  1026. +  {"volume",           P_STRING,  P_LOCAL,  &sDefault.volume,           NULL},
  1027.    {"force user",       P_STRING,  P_LOCAL,  &sDefault.force_user,       NULL},
  1028.    {"force group",      P_STRING,  P_LOCAL,  &sDefault.force_group,      NULL},
  1029.    {"group",            P_STRING,  P_LOCAL,  &sDefault.force_group,      NULL},
  1030. @@ -538,6 +548,7 @@
  1031.    Globals.os_level = 0;
  1032.    Globals.max_ttl = 60*60*4; /* 2 hours default */
  1033.    Globals.bPreferredMaster = True;
  1034. +  Globals.bDomainMaster = False;
  1035.  
  1036.  #ifdef KANJI
  1037.    coding_system = interpret_coding_system (KANJI, SJIS_CODE);
  1038. @@ -643,9 +654,11 @@
  1039.  FN_GLOBAL_STRING(lp_passwd_chat,&Globals.szPasswdChat)
  1040.  FN_GLOBAL_STRING(lp_passwordserver,&Globals.szPasswordServer)
  1041.  FN_GLOBAL_STRING(lp_workgroup,&Globals.szWorkGroup)
  1042. +FN_GLOBAL_STRING(lp_domain_controller,&Globals.szDomainController)
  1043.  FN_GLOBAL_STRING(lp_username_map,&Globals.szUsernameMap)
  1044.  FN_GLOBAL_STRING(lp_character_set,&Globals.szCharacterSet) 
  1045.  
  1046. +FN_GLOBAL_BOOL(lp_domain_master,&Globals.bDomainMaster)
  1047.  FN_GLOBAL_BOOL(lp_preferred_master,&Globals.bPreferredMaster)
  1048.  FN_GLOBAL_BOOL(lp_load_printers,&Globals.bLoadPrinters)
  1049.  FN_GLOBAL_BOOL(lp_use_rhosts,&Globals.bUseRhosts)
  1050. @@ -702,8 +715,10 @@
  1051.  FN_LOCAL_STRING(lp_force_group,force_group)
  1052.  FN_LOCAL_STRING(lp_readlist,readlist)
  1053.  FN_LOCAL_STRING(lp_writelist,writelist)
  1054. +FN_LOCAL_STRING(lp_volume,volume)
  1055.  FN_LOCAL_STRING(lp_mangled_map,szMangledMap)
  1056.  
  1057. +FN_LOCAL_BOOL(lp_alternate_permissions,bAlternatePerm)
  1058.  FN_LOCAL_BOOL(lp_revalidate,bRevalidate)
  1059.  FN_LOCAL_BOOL(lp_casesensitive,bCaseSensitive)
  1060.  FN_LOCAL_BOOL(lp_preservecase,bCasePreserve)
  1061. @@ -1828,3 +1843,12 @@
  1062.    return(res);
  1063.  }
  1064.  
  1065. +/*******************************************************************
  1066. +  a useful volume label function
  1067. +  ******************************************************************/
  1068. +char *volume_label(int snum)
  1069. +{
  1070. +  char *ret = lp_volume(snum);
  1071. +  if (!*ret) return(lp_servicename(snum));
  1072. +  return(ret);
  1073. +}
  1074. diff -u -r --new-file last-version/source/loadparm.h samba-1.9.15p3/source/loadparm.h
  1075. --- last-version/source/loadparm.h    Tue Nov 21 12:42:14 1995
  1076. +++ samba-1.9.15p3/source/loadparm.h    Wed Nov 22 18:01:21 1995
  1077. @@ -51,11 +51,13 @@
  1078.  extern char *lp_dfree_command(void);
  1079.  extern char *lp_msg_command(void);
  1080.  extern char *lp_workgroup(void);
  1081. +extern char *lp_domain_controller(void);
  1082.  extern char *lp_username_map(void);
  1083.  extern char *lp_hosts_equiv(void);
  1084.  extern char *lp_magicscript(int iService);
  1085.  extern char *lp_magicoutput(int iService);
  1086.  extern char *lp_mangled_map(int iService);
  1087. +char *volume_label(int snum);
  1088.  extern int  lp_os_level(void);
  1089.  extern int  lp_max_ttl(void);
  1090.  extern int  lp_max_log_size(void);
  1091. @@ -63,6 +65,7 @@
  1092.  extern int  lp_maxmux(void);
  1093.  extern int  lp_mangledstack(void);
  1094.  extern BOOL lp_preferred_master(void);
  1095. +extern BOOL lp_domain_master(void);
  1096.  extern BOOL lp_getwdcache(void);
  1097.  extern BOOL lp_use_rhosts(void);
  1098.  extern BOOL lp_readprediction(void);
  1099. @@ -107,6 +110,7 @@
  1100.  extern char *lp_force_group(int iService);
  1101.  extern char *lp_readlist(int iService);
  1102.  extern char *lp_writelist(int iService);
  1103. +extern BOOL lp_alternate_permissions(int iService);
  1104.  extern BOOL lp_revalidate(int iService);
  1105.  extern BOOL lp_status(int iService);
  1106.  extern BOOL lp_hide_dot_files(int iService);
  1107. diff -u -r --new-file last-version/source/nameserv.c samba-1.9.15p3/source/nameserv.c
  1108. --- last-version/source/nameserv.c    Tue Nov 21 12:44:03 1995
  1109. +++ samba-1.9.15p3/source/nameserv.c    Wed Nov 22 21:14:57 1995
  1110. @@ -29,6 +29,8 @@
  1111.  void process(void);
  1112.  static void dump_names(void);
  1113.  static void announce_request(char *group);
  1114. +void sync_browse_lists(char *name,int name_type,char *myname,
  1115. +               char *domain,struct in_addr ip);
  1116.  
  1117.  extern int DEBUGLEVEL;
  1118.  
  1119. @@ -77,7 +79,8 @@
  1120.  /* what server type are we currently */
  1121.  static int ServerType = 
  1122.  SV_TYPE_WORKSTATION | SV_TYPE_SERVER | SV_TYPE_TIME_SOURCE |
  1123. -SV_TYPE_PRINTQ_SERVER | SV_TYPE_SERVER_UNIX | SV_TYPE_POTENTIAL_BROWSER;
  1124. +SV_TYPE_SERVER_UNIX |
  1125. +SV_TYPE_PRINTQ_SERVER | SV_TYPE_POTENTIAL_BROWSER;
  1126.  
  1127.  /* here are my election parameters */
  1128.  
  1129. @@ -367,12 +370,15 @@
  1130.  
  1131.    bzero((char *)d,sizeof(*d));
  1132.  
  1133. +  if (zero_ip(ip)) ip = bcast_ip;
  1134. +
  1135.    StrnCpy(d->name,name,sizeof(d->name)-1);
  1136.    d->bcast_ip = ip;
  1137.  
  1138. -  if (!*PrimaryGroup && ip_equal(bcast_ip,ip) && name[0] != '*') {
  1139. +  if (!PrimaryGroup[0] && ip_equal(bcast_ip,ip) && name[0] != '*') {
  1140.      strcpy(PrimaryGroup,name);
  1141.      strupper(PrimaryGroup);
  1142. +    DEBUG(3,("Setting primary group to %s (%s)\n",PrimaryGroup,inet_ntoa(ip)));
  1143.    }
  1144.  
  1145.    add_domain(d);
  1146. @@ -389,17 +395,24 @@
  1147.  /****************************************************************************
  1148.    add a server entry
  1149.    ****************************************************************************/
  1150. -static struct server_record *add_server_entry(char *name,int servertype,
  1151. -                          int ttl,char *comment)
  1152. +struct server_record *add_server_entry(char *name,int servertype,
  1153. +                       int ttl,char *comment,BOOL replace)
  1154.  {
  1155.    BOOL newentry=False;
  1156.    struct server_record *s;
  1157.  
  1158. -  updatedlists=True;
  1159. +  ttl = MIN(ttl,lp_max_ttl());
  1160.  
  1161.    for (s = serverlist; s; s = s->next)
  1162.      if (strequal(name,s->name)) break;
  1163.  
  1164. +  if (s && !replace) {
  1165. +    DEBUG(4,("Not replacing %s\n",name));
  1166. +    return(s);
  1167. +  }
  1168. +
  1169. +  updatedlists=True;
  1170. +
  1171.    if (!s) {
  1172.      newentry = True;
  1173.      s = (struct server_record *)malloc(sizeof(*s));
  1174. @@ -421,8 +434,13 @@
  1175.  
  1176.    add_server(s);
  1177.  
  1178. -  DEBUG(3,("Added server entry %s of type %x (%s)\n",
  1179. -       name,servertype,comment));
  1180. +  if (newentry) {
  1181. +    DEBUG(3,("Added server entry %s of type %x (%s)\n",
  1182. +         name,servertype,comment));
  1183. +  } else {
  1184. +    DEBUG(3,("Updated server entry %s of type %x (%s)\n",
  1185. +         name,servertype,comment));
  1186. +  }
  1187.  
  1188.    return(s);
  1189.  }
  1190. @@ -435,8 +453,6 @@
  1191.  {
  1192.    struct in_addr ip = *interpret_addr2("0.0.0.0");
  1193.  
  1194. -  add_host_entry("__SAMBA__",0x20,True,0,SELF,ip);
  1195. -  add_host_entry("__SAMBA__",0x0,True,0,SELF,ip);
  1196.    add_host_entry(myname,0x20,True,0,SELF,ip);
  1197.    add_host_entry(myname,0x0,True,0,SELF,ip);
  1198.    add_host_entry(myname,0x1f,True,0,SELF,ip); /* used for chat, I think */
  1199. @@ -444,9 +460,13 @@
  1200.      add_domain_entry(lp_workgroup(),bcast_ip);
  1201.    add_server_entry(myname,
  1202.             ServerType,
  1203. -           0,ServerComment);
  1204. +           0,ServerComment,True);
  1205. +
  1206. +  add_host_entry("__SAMBA__",0x20,True,0,SELF,ip);
  1207. +  add_host_entry("__SAMBA__",0x0,True,0,SELF,ip);
  1208.  
  1209.    if (lp_preferred_master()) {
  1210. +    DEBUG(3,("Preferred master startup\n"));
  1211.      needelection = True;
  1212.      ElectionCriterion |= (1<<3);
  1213.    }
  1214. @@ -565,7 +585,7 @@
  1215.      if (t < lastrun + 5*60) return;
  1216.      lastrun = t;
  1217.  
  1218. -    if (!AM_MASTER && *PrimaryGroup &&
  1219. +    if (!AM_MASTER && PrimaryGroup[0] &&
  1220.      !name_query(ClientNMB,PrimaryGroup,0x1d,True,False,
  1221.              bcast_ip,NULL,queue_packet)) {
  1222.        DEBUG(2,("Forcing election on %s\n",PrimaryGroup));
  1223. @@ -759,8 +779,14 @@
  1224.    add_host_entry(PrimaryGroup,0x1d,True,0,SELF,myip);
  1225.    add_host_entry(PrimaryGroup,0x0,False,0,SELF,myip);
  1226.    add_host_entry(MSBROWSE,1,False,0,SELF,myip);
  1227. -  add_server_entry(PrimaryGroup,SV_TYPE_DOMAIN_ENUM,0,myname);
  1228. -  add_server_entry(myname,ServerType,0,ServerComment);    
  1229. +  add_server_entry(PrimaryGroup,SV_TYPE_DOMAIN_ENUM,0,myname,True);
  1230. +  add_server_entry(myname,ServerType,0,ServerComment,True);
  1231. +
  1232. +  if (lp_domain_master()) {
  1233. +    add_host_entry(PrimaryGroup,0x1b,True,0,SELF,myip);
  1234. +    add_host_entry(PrimaryGroup,0x1c,False,0,SELF,myip);
  1235. +    ServerType |= SV_TYPE_DOMAIN_MASTER;
  1236. +  }
  1237.  
  1238.    announce_request(PrimaryGroup);
  1239.  
  1240. @@ -779,12 +805,18 @@
  1241.    DEBUG(2,("Becoming non-master for %s\n",PrimaryGroup));
  1242.  
  1243.    ServerType &= ~SV_TYPE_MASTER_BROWSER;
  1244. +  ServerType &= ~SV_TYPE_DOMAIN_MASTER;
  1245. +
  1246.    ElectionCriterion &= ~0x4;
  1247.  
  1248.    make_nmb_name(&nn,PrimaryGroup,0x1d,scope);
  1249.    n = find_name(&nn);
  1250.    if (n && n->source == SELF) remove_name(n);
  1251.  
  1252. +  make_nmb_name(&nn,PrimaryGroup,0x1b,scope);
  1253. +  n = find_name(&nn);
  1254. +  if (n && n->source == SELF) remove_name(n);
  1255. +
  1256.    make_nmb_name(&nn,MSBROWSE,1,scope);
  1257.    n = find_name(&nn);
  1258.    if (n && n->source == SELF) remove_name(n);
  1259. @@ -799,7 +831,7 @@
  1260.    time_t t = time(NULL);
  1261.    static time_t lastime = 0;
  1262.  
  1263. -  if (!*PrimaryGroup || !RunningElection) return;
  1264. +  if (!PrimaryGroup[0] || !RunningElection) return;
  1265.  
  1266.    /* send election packets once a second */
  1267.    if (lastime &&
  1268. @@ -863,7 +895,7 @@
  1269.    StrnCpy(p+5,my_name,16);
  1270.    strupper(p+5);
  1271.    CVAL(p,21) = 2; /* major version */
  1272. -  CVAL(p,22) = 0; /* minor version */
  1273. +  CVAL(p,22) = 2; /* minor version */
  1274.    stypep = p+23;
  1275.    SIVAL(p,23,ServerType);
  1276.    SSVAL(p,27,0xaa55); /* browse signature */
  1277. @@ -929,6 +961,57 @@
  1278.           myname,group,0,0,bcast_ip,myip);
  1279.  }
  1280.  
  1281. +/****************************************************************************
  1282. +  announce myself as a master to the PDC
  1283. +  **************************************************************************/
  1284. +static void announce_master(char *group)
  1285. +{
  1286. +  static time_t last=0;
  1287. +  time_t t = time(NULL);
  1288. +  pstring outbuf;
  1289. +  char *p;
  1290. +  struct in_addr ip,pdc_ip;
  1291. +  fstring pdcname="";
  1292. +
  1293. +  if (!AM_MASTER || (last && (t-last < 10*60))) return;
  1294. +  last = t;
  1295. +
  1296. +  ip = *interpret_addr2(lp_domain_controller());
  1297. +
  1298. +  if (zero_ip(ip)) ip = bcast_ip;
  1299. +
  1300. +  if (!name_query(ClientNMB,PrimaryGroup,
  1301. +          0x1b,False,False,ip,&pdc_ip,queue_packet)) {
  1302. +    DEBUG(2,("Failed to find PDC at %s\n",lp_domain_controller()));
  1303. +    return;
  1304. +  }
  1305. +
  1306. +  name_status(ClientNMB,PrimaryGroup,0x1b,False,
  1307. +          pdc_ip,NULL,pdcname,queue_packet);
  1308. +
  1309. +  if (!pdcname[0]) {
  1310. +    DEBUG(3,("Can't find netbios name of PDC at %s\n",inet_ntoa(pdc_ip)));
  1311. +  } else {
  1312. +    sync_browse_lists(pdcname,0x20,myname,PrimaryGroup,pdc_ip);
  1313. +  }
  1314. +
  1315. +
  1316. +  DEBUG(2,("Sending master announce to %s for workgroup %s\n",
  1317. +       inet_ntoa(pdc_ip),group));
  1318. +
  1319. +  bzero(outbuf,sizeof(outbuf));
  1320. +  p = outbuf;
  1321. +  CVAL(p,0) = 13; /* announce request */
  1322. +  p++;
  1323. +
  1324. +  StrnCpy(p,myname,16);
  1325. +  strupper(p);
  1326. +  p = skip_string(p,1);
  1327. +
  1328. +  send_udp_dgram(ClientDGRAM,outbuf,PTR_DIFF(p,outbuf),
  1329. +         PrimaryGroup,myname,0x1b,0,pdc_ip,myip);
  1330. +}
  1331. +
  1332.  
  1333.  /*******************************************************************
  1334.    am I listening on a name. Should check name_type as well 
  1335. @@ -989,10 +1072,32 @@
  1336.    ttl = MIN(ttl,lp_max_ttl());
  1337.  
  1338.    /* add them to our browse list */
  1339. -  add_server_entry(name,servertype,ttl,comment);
  1340. +  add_server_entry(name,servertype,ttl,comment,True);
  1341. +
  1342.  }
  1343.  
  1344. +/*******************************************************************
  1345. +  process a master announcement frame
  1346. +  ******************************************************************/
  1347. +static void process_master_announce(struct packet_struct *p,char *buf)
  1348. +{
  1349. +  struct dgram_packet *dgram = &p->packet.dgram;
  1350. +  char *name = buf;
  1351. +
  1352. +  name[15] = 0;
  1353. +  
  1354. +  DEBUG(3,("Master Announce from %s (%s)\n",name,inet_ntoa(p->ip)));
  1355. +
  1356. +  if (strequal(dgram->source_name.name,myname)) return;
  1357. +
  1358. +  if (!AM_MASTER || !listening(&dgram->dest_name)) return;
  1359. +
  1360. +  /* merge browse lists with them */
  1361. +  if (lp_domain_master())
  1362. +    sync_browse_lists(name,0x20,myname,PrimaryGroup,p->ip);
  1363. +}
  1364.  
  1365. +
  1366.  /*******************************************************************
  1367.    process a backup list request
  1368.  
  1369. @@ -1143,6 +1248,10 @@
  1370.      case 9: /* get backup list */
  1371.        process_backup_list(p,buf+1);
  1372.        break;
  1373. +
  1374. +    case 13: /* master announcement */
  1375. +      process_master_announce(p,buf+1);
  1376. +      break;
  1377.      }
  1378.  }
  1379.  
  1380. @@ -1199,7 +1308,7 @@
  1381.    ret = name_query(ClientNMB,name1,0x1,True,False,ip,&ipout,queue_packet);
  1382.    if (!ret) return(False);
  1383.  
  1384. -  name_status(ClientNMB,name1,0x1,False,ipout,name,queue_packet);
  1385. +  name_status(ClientNMB,name1,0x1,False,ipout,name,NULL,queue_packet);
  1386.  
  1387.    if (name[0] != '*') {
  1388.      DEBUG(2,("Found workgroup %s on broadcast %s\n",name,inet_ntoa(ip)));
  1389. @@ -1226,7 +1335,7 @@
  1390.        if (!find_workgroup(d->name,d->bcast_ip)) continue;
  1391.        add_host_entry(d->name,0x1e,False,0,SELF,
  1392.               *interpret_addr2("255.255.255.255"));
  1393. -      if (!*PrimaryGroup && ip_equal(bcast_ip,d->bcast_ip)) {
  1394. +      if (!PrimaryGroup[0] && ip_equal(bcast_ip,d->bcast_ip)) {
  1395.      strcpy(PrimaryGroup,d->name);
  1396.      strupper(PrimaryGroup);
  1397.        }
  1398. @@ -1235,6 +1344,10 @@
  1399.      announce_host(d,myname,ServerComment);
  1400.    }
  1401.  
  1402. +  /* if I have a domain controller then announce to it */
  1403. +  if (AM_MASTER && *lp_domain_controller())
  1404. +    announce_master(PrimaryGroup);
  1405. +
  1406.    needannounce=False;
  1407.  }
  1408.  
  1409. @@ -1484,15 +1597,15 @@
  1410.      }
  1411.  
  1412.    /* XXXXXXX we should fill in more fields of the statistics structure */
  1413. -  bzero(buf,46);
  1414. -  putip(buf,(char *)&myip);
  1415. +  bzero(buf,64);
  1416.    {
  1417.      extern int num_good_sends,num_good_receives;
  1418.      SIVAL(buf,20,num_good_sends);
  1419.      SIVAL(buf,24,num_good_receives);
  1420.    }
  1421. +  SIVAL(buf,46,0xFFB8E5); /* undocumented - used by NT */
  1422.  
  1423. -  buf += 46;
  1424. +  buf += 64;
  1425.  
  1426.    nmb2->answers->rdlength = PTR_DIFF(buf,&nmb2->answers->rdata[0]);
  1427.  
  1428. @@ -1748,7 +1861,7 @@
  1429.        int selrtn;
  1430.        struct timeval timeout;
  1431.  
  1432. -      if (needelection && *PrimaryGroup && !RunningElection) {
  1433. +      if (needelection && PrimaryGroup[0] && !RunningElection) {
  1434.      DEBUG(3,(">>> Starting election on %s <<<\n",PrimaryGroup));
  1435.      ElectionCount = 0;
  1436.      RunningElection = True;
  1437. diff -u -r --new-file last-version/source/nameserv.h samba-1.9.15p3/source/nameserv.h
  1438. --- last-version/source/nameserv.h    Sun Nov 19 17:50:31 1995
  1439. +++ samba-1.9.15p3/source/nameserv.h    Wed Nov 22 18:32:05 1995
  1440. @@ -25,6 +25,7 @@
  1441.  
  1442.  #define NMB_PORT 137
  1443.  #define DGRAM_PORT 138
  1444. +#define SMB_PORT 139
  1445.  
  1446.  enum name_source {LMHOSTS, REGISTER, SELF, DNS, DNSFAIL};
  1447.  enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3};
  1448. @@ -173,7 +174,8 @@
  1449.                 BOOL bcast,BOOL recurse,
  1450.                 struct in_addr to_ip, struct in_addr *ip,void (*fn)());
  1451.  BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
  1452. -            struct in_addr to_ip,char *master,void (*fn)());
  1453. +         struct in_addr to_ip,char *master,char *rname,
  1454. +         void (*fn)());
  1455.  BOOL send_udp_dgram(int fd,char *buf,int len,
  1456.                 char *srcname,char *dstname,
  1457.                 int src_type,int dest_type,
  1458. Only in last-version/source: nameserv2.c
  1459. diff -u -r --new-file last-version/source/nmblib.c samba-1.9.15p3/source/nmblib.c
  1460. --- last-version/source/nmblib.c    Tue Nov 14 21:23:08 1995
  1461. +++ samba-1.9.15p3/source/nmblib.c    Wed Nov 22 18:42:17 1995
  1462. @@ -609,12 +609,15 @@
  1463.  /****************************************************************************
  1464.  interpret a node status response
  1465.  ****************************************************************************/
  1466. -static void interpret_node_status(char *p, char *master)
  1467. +static void interpret_node_status(char *p, char *master,char *rname)
  1468.  {
  1469. -  int level = master?3:0;
  1470. +  int level = (master||rname)?4:0;
  1471.    int numnames = CVAL(p,0);
  1472.    DEBUG(level,("received %d names\n",numnames));
  1473.  
  1474. +  if (rname) *rname = 0;
  1475. +  if (master) *master = 0;
  1476. +
  1477.    p += 1;
  1478.    while (numnames--)
  1479.      {
  1480. @@ -635,10 +638,15 @@
  1481.        if (p[0] & 0x04) strcat(flags,"<ACTIVE> ");
  1482.        if (p[0] & 0x02) strcat(flags,"<PERMANENT> ");
  1483.  
  1484. -      if (master && type == 0x1d) {
  1485. +      if (master && !*master && type == 0x1d) {
  1486.      StrnCpy(master,qname,15);
  1487.      trim_string(master,NULL," ");
  1488.        }
  1489. +
  1490. +      if (rname && !*rname && type == 0x20 && !(p[0]&0x80)) {
  1491. +    StrnCpy(rname,qname,15);
  1492. +    trim_string(rname,NULL," ");
  1493. +      }
  1494.        
  1495.        DEBUG(level,("\t%s (type=0x%x)\t%s\n",qname,type,flags));
  1496.        p+=2;
  1497. @@ -654,7 +662,8 @@
  1498.    the "master" parameter is a hack used for finding workgroups.
  1499.    **************************************************************************/
  1500.  BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
  1501. -            struct in_addr to_ip,char *master,void (*fn)())
  1502. +         struct in_addr to_ip,char *master,char *rname,
  1503. +         void (*fn)())
  1504.  {
  1505.    BOOL found=False;
  1506.    int retries = 2;
  1507. @@ -730,14 +739,15 @@
  1508.        if (nmb2->header.opcode != 0 ||
  1509.            nmb2->header.nm_flags.bcast ||
  1510.            nmb2->header.rcode ||
  1511. -          !nmb2->header.ancount) {
  1512. +          !nmb2->header.ancount ||
  1513. +          nmb2->answers->rr_type != 0x21) {
  1514.          /* XXXX what do we do with this? could be a redirect, but
  1515.             we'll discard it for the moment */
  1516.          free_packet(p2);
  1517.          continue;
  1518.        }
  1519.  
  1520. -      interpret_node_status(&nmb2->answers->rdata[0], master);
  1521. +      interpret_node_status(&nmb2->answers->rdata[0], master,rname);
  1522.        free_packet(p2);
  1523.        return(True);
  1524.      }
  1525. diff -u -r --new-file last-version/source/nmblookup.c samba-1.9.15p3/source/nmblookup.c
  1526. --- last-version/source/nmblookup.c    Sun Nov 12 12:39:46 1995
  1527. +++ samba-1.9.15p3/source/nmblookup.c    Wed Nov 22 18:33:01 1995
  1528. @@ -201,7 +201,7 @@
  1529.        if (find_status) 
  1530.          {
  1531.            printf("Looking up status of %s\n",inet_ntoa(ip));
  1532. -          name_status(ServerFD,lookup,lookup_type,True,ip,NULL,NULL);
  1533. +          name_status(ServerFD,lookup,lookup_type,True,ip,NULL,NULL,NULL);
  1534.            printf("\n");
  1535.          }
  1536.        } else {
  1537. diff -u -r --new-file last-version/source/nmbsync.c samba-1.9.15p3/source/nmbsync.c
  1538. --- last-version/source/nmbsync.c    Thu Jan  1 10:00:00 1970
  1539. +++ samba-1.9.15p3/source/nmbsync.c    Wed Nov 22 18:16:20 1995
  1540. @@ -0,0 +1,299 @@
  1541. +/* 
  1542. +   Unix SMB/Netbios implementation.
  1543. +   Version 1.9.
  1544. +   NBT netbios routines to synchronise browse lists
  1545. +   Copyright (C) Andrew Tridgell 1994-1995
  1546. +   
  1547. +   This program is free software; you can redistribute it and/or modify
  1548. +   it under the terms of the GNU General Public License as published by
  1549. +   the Free Software Foundation; either version 2 of the License, or
  1550. +   (at your option) any later version.
  1551. +   
  1552. +   This program is distributed in the hope that it will be useful,
  1553. +   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1554. +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1555. +   GNU General Public License for more details.
  1556. +   
  1557. +   You should have received a copy of the GNU General Public License
  1558. +   along with this program; if not, write to the Free Software
  1559. +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1560. +   
  1561. +*/
  1562. +
  1563. +#include "includes.h"
  1564. +#include "loadparm.h"
  1565. +#include "nameserv.h"
  1566. +
  1567. +extern int DEBUGLEVEL;
  1568. +
  1569. +struct server_record *add_server_entry(char *name,int servertype,
  1570. +                       int ttl,char *comment,BOOL replace);
  1571. +
  1572. +
  1573. +/****************************************************************************
  1574. +call a remote api
  1575. +****************************************************************************/
  1576. +static BOOL call_remote_api(int fd,int cnum,int uid,int timeout,
  1577. +                char *inbuf,char *outbuf,
  1578. +                int prcnt,int drcnt,
  1579. +                int mprcnt,int mdrcnt,
  1580. +                int *rprcnt,int *rdrcnt,
  1581. +                char *param,char *data,
  1582. +                char **rparam,char **rdata)
  1583. +{
  1584. +  char *p1,*p2;
  1585. +
  1586. +  /* send a SMBtrans command */
  1587. +  bzero(outbuf,smb_size);
  1588. +  set_message(outbuf,14,0,True);
  1589. +  CVAL(outbuf,smb_com) = SMBtrans;
  1590. +  SSVAL(outbuf,smb_tid,cnum);
  1591. +  SSVAL(outbuf,smb_uid,uid);
  1592. +
  1593. +  p1 = smb_buf(outbuf);
  1594. +  strcpy(p1,"\\PIPE\\LANMAN");
  1595. +  p1 = skip_string(p1,1);
  1596. +  p2 = p1 + prcnt;
  1597. +
  1598. +  if (prcnt > 0)
  1599. +    memcpy(p1,param,prcnt);
  1600. +  if (drcnt > 0)
  1601. +    memcpy(p2,data,drcnt);
  1602. +
  1603. +  SSVAL(outbuf,smb_vwv0,prcnt); /* param count */
  1604. +  SSVAL(outbuf,smb_vwv1,drcnt); /* data count */
  1605. +  SSVAL(outbuf,smb_vwv2,mprcnt); /* mprcnt */
  1606. +  SSVAL(outbuf,smb_vwv3,mdrcnt); /* mdrcnt */
  1607. +  SSVAL(outbuf,smb_vwv4,0); /* msrcnt */
  1608. +  SSVAL(outbuf,smb_vwv5,0); /* flags */
  1609. +  SSVAL(outbuf,smb_vwv9,prcnt); /* pscnt */
  1610. +  SSVAL(outbuf,smb_vwv10,smb_offset(p1,outbuf)); /* psoff */
  1611. +  SSVAL(outbuf,smb_vwv11,drcnt); /* dscnt */
  1612. +  SSVAL(outbuf,smb_vwv12,smb_offset(p2,outbuf)); /* dsoff */
  1613. +  CVAL(outbuf,smb_vwv13) = 0; /* suwcnt */
  1614. +
  1615. +  set_message(outbuf,14,PTR_DIFF(p2+drcnt,smb_buf(outbuf)),False);
  1616. +
  1617. +  send_smb(fd,outbuf);
  1618. +  
  1619. +  if (receive_smb(fd,inbuf,timeout) &&
  1620. +      CVAL(inbuf,smb_rcls) == 0)
  1621. +    {
  1622. +      if (rparam)
  1623. +    *rparam = inbuf+4 + SVAL(inbuf,smb_vwv4);
  1624. +      if (rdata)
  1625. +    *rdata = inbuf+4 + SVAL(inbuf,smb_vwv7);
  1626. +      if (rprcnt)
  1627. +    *rprcnt = SVAL(inbuf,smb_vwv3);
  1628. +      if (rdrcnt)
  1629. +    *rdrcnt = SVAL(inbuf,smb_vwv6);
  1630. +      return(True);
  1631. +    }
  1632. +
  1633. +  return(False);
  1634. +}
  1635. +
  1636. +
  1637. +/*******************************************************************
  1638. +  synchronise browse lists with another browse server
  1639. +  ******************************************************************/
  1640. +void sync_browse_lists(char *name,int name_type,char *myname,
  1641. +               char *domain,struct in_addr ip)
  1642. +{
  1643. +  char *protocol = "LM1.2X002";
  1644. +  char *service = "IPC$";
  1645. +  char *dev = "IPC";
  1646. +  int timeout=2000;
  1647. +  char *inbuf=NULL;
  1648. +  pstring outbuf;
  1649. +  char *p;
  1650. +  int len;
  1651. +  uint32 sesskey;
  1652. +  int cnum,uid;
  1653. +  BOOL ret;
  1654. +
  1655. +  int fd = open_socket_out(SOCK_STREAM, &ip, SMB_PORT);
  1656. +  if (fd < 0) {
  1657. +    DEBUG(3,("Failed to connect to %s at %s\n",name,inet_ntoa(ip)));
  1658. +    return;
  1659. +  }
  1660. +
  1661. +  if (!(inbuf = (char *)malloc(0xFFFF+1024))) return;  
  1662. +
  1663. +  /* put in the destination name */
  1664. +  len = 4;
  1665. +  p = outbuf+len;
  1666. +  name_mangle(name,p,name_type);
  1667. +  len += name_len(p);
  1668. +
  1669. +  /* and my name */
  1670. +  p = outbuf+len;
  1671. +  name_mangle(myname,p,0x20);
  1672. +  len += name_len(p);
  1673. +
  1674. +  _smb_setlen(outbuf,len);
  1675. +  CVAL(outbuf,0) = 0x81;
  1676. +
  1677. +  send_smb(fd,outbuf);
  1678. +  receive_smb(fd,inbuf,5000);
  1679. +  
  1680. +  bzero(outbuf,smb_size);
  1681. +
  1682. +  /* setup the protocol string */
  1683. +  set_message(outbuf,0,strlen(protocol)+2,True);
  1684. +  p = smb_buf(outbuf);
  1685. +  *p++ = 2;
  1686. +  strcpy(p,protocol);
  1687. +
  1688. +  CVAL(outbuf,smb_com) = SMBnegprot;
  1689. +  CVAL(outbuf,smb_flg) = 0x8;
  1690. +  SSVAL(outbuf,smb_flg2,0x1);
  1691. +
  1692. +  send_smb(fd,outbuf);
  1693. +  bzero(inbuf,smb_size);
  1694. +  ret = receive_smb(fd,inbuf,timeout);
  1695. +  
  1696. +  if (!ret || CVAL(inbuf,smb_rcls) || SVAL(inbuf,smb_vwv0)) {
  1697. +    DEBUG(3,("%s rejected the protocol\n",name));
  1698. +    close(fd);
  1699. +    if (inbuf) free(inbuf);
  1700. +    return;
  1701. +  }
  1702. +
  1703. +  sesskey = IVAL(inbuf,smb_vwv6);
  1704. +
  1705. +  bzero(outbuf,smb_size);
  1706. +  set_message(outbuf,10,2,True);
  1707. +  CVAL(outbuf,smb_com) = SMBsesssetupX;
  1708. +
  1709. +  CVAL(outbuf,smb_vwv0) = 0xFF;
  1710. +  SSVAL(outbuf,smb_vwv2,0xFFFF);
  1711. +  SSVAL(outbuf,smb_vwv3,2);
  1712. +  SSVAL(outbuf,smb_vwv4,1);
  1713. +  SIVAL(outbuf,smb_vwv5,sesskey);
  1714. +  SSVAL(outbuf,smb_vwv7,1);
  1715. +
  1716. +  send_smb(fd,outbuf);
  1717. +  bzero(inbuf,smb_size);
  1718. +  ret = receive_smb(fd,inbuf,timeout);
  1719. +  if (!ret || CVAL(inbuf,smb_rcls)) {
  1720. +    DEBUG(3,("%s rejected session setup\n",name));
  1721. +    close(fd);
  1722. +    if (inbuf) free(inbuf);
  1723. +    return;
  1724. +  }
  1725. +
  1726. +  uid = SVAL(inbuf,smb_uid);
  1727. +
  1728. +  bzero(outbuf,smb_size);
  1729. +  set_message(outbuf,4,2 + strlen(service) + 1 + strlen(dev),True);
  1730. +  CVAL(outbuf,smb_com) = SMBtconX;
  1731. +  SSVAL(outbuf,smb_uid,uid);
  1732. +
  1733. +  SSVAL(outbuf,smb_vwv0,0xFF);
  1734. +  SSVAL(outbuf,smb_vwv3,1);
  1735. +
  1736. +  p = smb_buf(outbuf) + 1;
  1737. +  strcpy(p,service);
  1738. +  p = skip_string(p,1);
  1739. +  strcpy(p,dev);
  1740. +
  1741. +  send_smb(fd,outbuf);
  1742. +  bzero(inbuf,smb_size);
  1743. +  ret = receive_smb(fd,inbuf,timeout);
  1744. +  if (!ret || CVAL(inbuf,smb_rcls)) {
  1745. +    DEBUG(3,("%s rejected IPC connect (%d,%d)\n",name,
  1746. +         CVAL(inbuf,smb_rcls),SVAL(inbuf,smb_err)));
  1747. +    close(fd);
  1748. +    if (inbuf) free(inbuf);
  1749. +    return;
  1750. +  }
  1751. +
  1752. +  cnum = SVAL(inbuf,smb_tid);
  1753. +  
  1754. +  /* now I need to send a NetServerEnum */
  1755. +  {
  1756. +    fstring param;
  1757. +    uint32 *typep;
  1758. +    char *rparam,*rdata;
  1759. +
  1760. +    p = param;
  1761. +    SSVAL(p,0,0x68); /* api number */
  1762. +    p += 2;
  1763. +    strcpy(p,"WrLehDz");
  1764. +    p = skip_string(p,1);
  1765. +
  1766. +    strcpy(p,"B16BBDz");
  1767. +
  1768. +    p = skip_string(p,1);
  1769. +    SSVAL(p,0,1); /* level 1 */
  1770. +    SSVAL(p,2,0xFFFF - 500); /* buf length */
  1771. +    p += 4;
  1772. +    typep = (uint32 *)p;
  1773. +    p += 4;
  1774. +    strcpy(p,domain);
  1775. +    strupper(p);
  1776. +    p = skip_string(p,1);
  1777. +
  1778. +    SIVAL(typep,0,0x80000000); /* domain list */
  1779. +
  1780. +    if (call_remote_api(fd,cnum,uid,timeout,inbuf,outbuf,
  1781. +            PTR_DIFF(p,param),0,
  1782. +            8,0xFFFF - 500,
  1783. +            NULL,NULL,
  1784. +            param,NULL,
  1785. +            &rparam,&rdata) && SVAL(rparam,0)==0)
  1786. +    {
  1787. +      int converter=SVAL(rparam,2);
  1788. +      int count=SVAL(rparam,4);
  1789. +      int i;
  1790. +      char *p2 = rdata;
  1791. +      for (i=0;i<count;i++) {
  1792. +    char *sname = p2;
  1793. +    uint32 type = IVAL(p2,18);
  1794. +    int comment_offset = IVAL(p2,22) & 0xFFFF;
  1795. +    char *comment = comment_offset?(rdata+comment_offset-converter):"";
  1796. +
  1797. +    add_server_entry(sname,type,lp_max_ttl(),comment,False);
  1798. +    p2 += 26;
  1799. +      }
  1800. +    }
  1801. +
  1802. +    SIVAL(typep,0,0xFFFFFFFF); /* server list */
  1803. +
  1804. +    if (call_remote_api(fd,cnum,uid,timeout,inbuf,outbuf,
  1805. +            PTR_DIFF(p,param),0,
  1806. +            8,0xFFFF - 500,
  1807. +            NULL,NULL,
  1808. +            param,NULL,
  1809. +            &rparam,&rdata) && SVAL(rparam,0)==0)
  1810. +    {
  1811. +      int converter=SVAL(rparam,2);
  1812. +      int count=SVAL(rparam,4);
  1813. +      int i;
  1814. +
  1815. +      p = rdata;
  1816. +      for (i=0;i<count;i++) {
  1817. +    char *sname = p;
  1818. +    uint32 type = IVAL(p,18);
  1819. +    int comment_offset = IVAL(p,22) & 0xFFFF;
  1820. +    char *comment = comment_offset?(rdata+comment_offset-converter):"";
  1821. +
  1822. +    add_server_entry(sname,type,lp_max_ttl(),comment,False);
  1823. +    p += 26;
  1824. +      }
  1825. +    }
  1826. +  }
  1827. +
  1828. +  /* close up */
  1829. +  bzero(outbuf,smb_size);
  1830. +  set_message(outbuf,0,0,True);
  1831. +  CVAL(outbuf,smb_com) = SMBtdis;
  1832. +  SSVAL(outbuf,smb_uid,uid);
  1833. +  SSVAL(outbuf,smb_tid,cnum);
  1834. +  send_smb(fd,outbuf);
  1835. +  receive_smb(fd,inbuf,1000);
  1836. +  
  1837. +  close(fd);
  1838. +  if (inbuf) free(inbuf);
  1839. +}
  1840. diff -u -r --new-file last-version/source/password.c samba-1.9.15p3/source/password.c
  1841. --- last-version/source/password.c    Sun Nov 12 12:29:44 1995
  1842. +++ samba-1.9.15p3/source/password.c    Wed Nov 22 14:57:44 1995
  1843. @@ -1202,8 +1202,6 @@
  1844.    pstring inbuf,outbuf;
  1845.    fstring pass_protocol;
  1846.    extern fstring remote_machine;
  1847. -  extern int Client;
  1848. -  int SavedClient = Client;
  1849.    char *p;
  1850.    int len;
  1851.    fstring desthost;
  1852. @@ -1266,10 +1264,8 @@
  1853.    _smb_setlen(outbuf,len);
  1854.    CVAL(outbuf,0) = 0x81;
  1855.  
  1856. -  Client = password_client;
  1857. -  send_smb(outbuf);
  1858. -  receive_smb(inbuf,5000);
  1859. -  Client = SavedClient;
  1860. +  send_smb(password_client,outbuf);
  1861. +  receive_smb(password_client,inbuf,5000);
  1862.   
  1863.    if (CVAL(inbuf,0) != 0x82) {
  1864.      DEBUG(1,("%s rejected the session\n",pserver));
  1865. @@ -1291,10 +1287,8 @@
  1866.    CVAL(outbuf,smb_flg) = 0x8;
  1867.    SSVAL(outbuf,smb_flg2,0x1);
  1868.  
  1869. -  Client = password_client;
  1870. -  send_smb(outbuf);
  1871. -  ret = receive_smb(inbuf,5000);
  1872. -  Client = SavedClient;
  1873. +  send_smb(password_client,outbuf);
  1874. +  ret = receive_smb(password_client,inbuf,5000);
  1875.  
  1876.    if (!ret || CVAL(inbuf,smb_rcls) || SVAL(inbuf,smb_vwv0)) {
  1877.      DEBUG(1,("%s rejected the protocol\n",pserver));
  1878. @@ -1321,8 +1315,6 @@
  1879.  BOOL server_validate(char *buf)
  1880.  {
  1881.    pstring inbuf,outbuf;  
  1882. -  extern int Client;
  1883. -  int SavedClient = Client;
  1884.    char *pserver = lp_passwordserver();
  1885.    BOOL ret;
  1886.  
  1887. @@ -1343,10 +1335,8 @@
  1888.  
  1889.    SCVAL(inbuf,smb_rcls,1);
  1890.  
  1891. -  Client = password_client;
  1892. -  send_smb(outbuf);
  1893. -  ret = receive_smb(inbuf,5000);
  1894. -  Client = SavedClient;
  1895. +  send_smb(password_client,outbuf);
  1896. +  ret = receive_smb(password_client,inbuf,5000);
  1897.  
  1898.    if (!ret || CVAL(inbuf,smb_rcls) != 0) {
  1899.      DEBUG(1,("password server %s rejected the password\n",pserver));
  1900. diff -u -r --new-file last-version/source/reply.c samba-1.9.15p3/source/reply.c
  1901. --- last-version/source/reply.c    Tue Nov 21 00:06:48 1995
  1902. +++ samba-1.9.15p3/source/reply.c    Wed Nov 22 21:35:16 1995
  1903. @@ -761,7 +761,7 @@
  1904.        if ((dirtype&0x1F) == aVOLID)
  1905.          {      
  1906.            memcpy(p,status,21);
  1907. -          make_dir_struct(p,"???????????",SERVICE(SNUM(cnum)),0,aVOLID,0);
  1908. +          make_dir_struct(p,"???????????",volume_label(SNUM(cnum)),0,aVOLID,0);
  1909.            dptr_fill(p+12,dptr_num);
  1910.            if (dptr_zero(p+12) && (status_len==0))
  1911.          numentries = 1;
  1912. @@ -1577,7 +1577,7 @@
  1913.    CVAL(outbuf,smb_com) = SMBwritebraw;
  1914.    SSVALS(outbuf,smb_vwv0,-1);
  1915.    outsize = set_message(outbuf,Protocol>PROTOCOL_COREPLUS?1:0,0,True);
  1916. -  send_smb(outbuf);
  1917. +  send_smb(Client,outbuf);
  1918.    
  1919.    /* Now read the raw data into the buffer and write it */
  1920.    if(read_smb_length(Client,inbuf,0) == -1) {
  1921. @@ -2107,7 +2107,7 @@
  1922.  
  1923.        smb_setlen(outbuf,outsize - 4);
  1924.  
  1925. -      send_smb(outbuf);
  1926. +      send_smb(Client,outbuf);
  1927.      }
  1928.  
  1929.    DEBUG(3,("%s echo %d times cnum=%d\n",timestring(),smb_reverb,cnum));
  1930. @@ -2519,6 +2519,10 @@
  1931.      !file_exist(newname,NULL) &&
  1932.      !sys_rename(directory,newname)) count++;
  1933.      if (!count) exists = file_exist(directory,NULL);
  1934. +    if (!count && exists && file_exist(newname,NULL)) {
  1935. +      exists = True;
  1936. +      error = 183;
  1937. +    }
  1938.    } else {
  1939.      void *dirptr = NULL;
  1940.      char *dname;
  1941. @@ -2545,9 +2549,14 @@
  1942.          sprintf(fname,"%s/%s",directory,dname);
  1943.          if (!can_rename(fname,cnum)) continue;
  1944.          strcpy(destname,newname);
  1945. -        if (resolve_wildcards(fname,destname) && 
  1946. -        !file_exist(destname,NULL) && 
  1947. -        !sys_rename(fname,destname)) count++;
  1948. +
  1949. +        if (!resolve_wildcards(fname,destname)) continue;
  1950. +
  1951. +        if (file_exist(destname,NULL)) {
  1952. +          error = 183;
  1953. +          continue;
  1954. +        }
  1955. +        if (!sys_rename(fname,destname)) count++;
  1956.          DEBUG(3,("reply_mv : doing rename on %s -> %s\n",fname,destname));
  1957.        }
  1958.      CloseDir(dirptr);
  1959. @@ -2932,7 +2941,7 @@
  1960.        SSVAL(outbuf,smb_vwv6,nread);
  1961.        SSVAL(outbuf,smb_vwv7,smb_offset(data,outbuf));
  1962.  
  1963. -      send_smb(outbuf);
  1964. +      send_smb(Client,outbuf);
  1965.  
  1966.        total_read += nread;
  1967.        startpos += nread;
  1968. @@ -3027,7 +3036,7 @@
  1969.    if (write_through && tcount==nwritten) {
  1970.      /* we need to send both a primary and a secondary response */
  1971.      smb_setlen(outbuf,outsize - 4);
  1972. -    send_smb(outbuf);
  1973. +    send_smb(Client,outbuf);
  1974.  
  1975.      /* now the secondary */
  1976.      outsize = set_message(outbuf,1,0,True);
  1977. @@ -3194,7 +3203,7 @@
  1978.    else
  1979.      {
  1980.        SIVAL(outbuf,smb_vwv6,sbuf.st_size);
  1981. -      SIVAL(outbuf,smb_vwv8,sbuf.st_size);
  1982. +      SIVAL(outbuf,smb_vwv8,ROUNDUP(sbuf.st_size,1024));
  1983.      }
  1984.    SSVAL(outbuf,smb_vwv10, mode);
  1985.    
  1986. diff -u -r --new-file last-version/source/reply.h samba-1.9.15p3/source/reply.h
  1987. --- last-version/source/reply.h    Mon Nov 20 22:59:13 1995
  1988. +++ samba-1.9.15p3/source/reply.h    Wed Nov 22 21:52:38 1995
  1989. @@ -57,3 +57,4 @@
  1990.  int reply_sendstrt(char *inbuf,char *outbuf);
  1991.  int reply_sendend(char *inbuf,char *outbuf);
  1992.  int reply_sendtxt(char *inbuf,char *outbuf);
  1993. +int reply_transs2(char *inbuf,char *outbuf,int length,int bufsize);
  1994. diff -u -r --new-file last-version/source/server.c samba-1.9.15p3/source/server.c
  1995. --- last-version/source/server.c    Tue Nov 21 12:49:16 1995
  1996. +++ samba-1.9.15p3/source/server.c    Wed Nov 22 21:50:33 1995
  1997. @@ -159,7 +159,7 @@
  1998.                        Connections[cnum].igroups))))
  1999.      result |= aRONLY;
  2000.  #else
  2001. -  if (CAN_WRITE(cnum)) {
  2002. +  if (CAN_WRITE(cnum) && !lp_alternate_permissions(SNUM(cnum))) {
  2003.      if (!((sbuf->st_mode & S_IWOTH) ||
  2004.        Connections[cnum].admin_user ||
  2005.        ((sbuf->st_mode & S_IWUSR) && Connections[cnum].uid==sbuf->st_uid) ||
  2006. @@ -2860,6 +2860,36 @@
  2007.  }
  2008.  
  2009.  
  2010. +/* these are the protocol lists used for auto architecture detection:
  2011. +
  2012. +WinNT 3.51:
  2013. +protocol [PC NETWORK PROGRAM 1.0]
  2014. +protocol [XENIX CORE]
  2015. +protocol [MICROSOFT NETWORKS 1.03]
  2016. +protocol [LANMAN1.0]
  2017. +protocol [Windows for Workgroups 3.1a]
  2018. +protocol [LM1.2X002]
  2019. +protocol [LANMAN2.1]
  2020. +protocol [NT LM 0.12]
  2021. +
  2022. +Win95:
  2023. +protocol [PC NETWORK PROGRAM 1.0]
  2024. +protocol [XENIX CORE]
  2025. +protocol [MICROSOFT NETWORKS 1.03]
  2026. +protocol [LANMAN1.0]
  2027. +protocol [Windows for Workgroups 3.1a]
  2028. +protocol [LM1.2X002]
  2029. +protocol [LANMAN2.1]
  2030. +protocol [NT LM 0.12]
  2031. +
  2032. +OS/2:
  2033. +protocol [PC NETWORK PROGRAM 1.0]
  2034. +protocol [XENIX CORE]
  2035. +protocol [LANMAN1.0]
  2036. +protocol [LM1.2X002]
  2037. +protocol [LANMAN2.1]
  2038. +*/
  2039. +
  2040.  /****************************************************************************
  2041.    reply to a negprot
  2042.  ****************************************************************************/
  2043. @@ -3441,7 +3471,7 @@
  2044.     {SMBfindnclose, "SMBfindnclose", reply_findnclose, AS_USER},
  2045.     {SMBfindclose, "SMBfindclose", reply_findclose,AS_USER},
  2046.     {SMBtrans2, "SMBtrans2", reply_trans2, AS_USER},
  2047. -   {SMBtranss2, "SMBtranss2", NULL, AS_USER},
  2048. +   {SMBtranss2, "SMBtranss2", reply_transs2, AS_USER},
  2049.  
  2050.     /* messaging routines */
  2051.     {SMBsends,"SMBsends",reply_sends,AS_GUEST},
  2052. @@ -3797,7 +3827,7 @@
  2053.        errno = 0;      
  2054.  
  2055.        for (counter=SMBD_SELECT_LOOP; 
  2056. -       !receive_smb(InBuffer,SMBD_SELECT_LOOP*1000); 
  2057. +       !receive_smb(Client,InBuffer,SMBD_SELECT_LOOP*1000); 
  2058.         counter += SMBD_SELECT_LOOP)
  2059.      {
  2060.        int i;
  2061. @@ -3898,7 +3928,7 @@
  2062.               smb_len(OutBuffer)));
  2063.        }
  2064.      else
  2065. -      send_smb(OutBuffer);
  2066. +      send_smb(Client,OutBuffer);
  2067.        }
  2068.        trans_num++;
  2069.      }
  2070. diff -u -r --new-file last-version/source/smb.h samba-1.9.15p3/source/smb.h
  2071. --- last-version/source/smb.h    Tue Nov 14 21:55:41 1995
  2072. +++ samba-1.9.15p3/source/smb.h    Wed Nov 22 14:58:18 1995
  2073. @@ -749,11 +749,11 @@
  2074.  BOOL file_exist(char *fname,struct stat *sbuf);
  2075.  int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt, long time_out, BOOL exact);
  2076.  void close_sockets(void );
  2077. -BOOL send_smb(char *buffer);
  2078. +BOOL send_smb(int fd,char *buffer);
  2079.  BOOL send_keepalive(int client);
  2080.  int read_data(int fd,char *buffer,int N);
  2081.  int smb_len(char *buf);
  2082. -BOOL receive_smb(char *buffer,int timeout);
  2083. +BOOL receive_smb(int fd,char *buffer,int timeout);
  2084.  void show_msg(char *buf);
  2085.  BOOL big_endian(void );
  2086.  BOOL become_user(int cnum, int uid);
  2087. @@ -977,6 +977,8 @@
  2088.  
  2089.  /* this is how errors are generated */
  2090.  #define UNIXERROR(defclass,deferror) unix_error_packet(inbuf,outbuf,defclass,deferror,__LINE__)
  2091. +
  2092. +#define ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1))
  2093.  
  2094.  #endif 
  2095.  /* _SMB_H */
  2096. diff -u -r --new-file last-version/source/trans2.c samba-1.9.15p3/source/trans2.c
  2097. --- last-version/source/trans2.c    Mon Nov 20 19:08:34 1995
  2098. +++ samba-1.9.15p3/source/trans2.c    Wed Nov 22 21:52:27 1995
  2099. @@ -30,9 +30,8 @@
  2100.  extern connection_struct Connections[];
  2101.  extern files_struct Files[];
  2102.  extern BOOL case_sensitive;
  2103. +extern int Client;
  2104.  
  2105. -#define ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1))
  2106. -
  2107.  /****************************************************************************
  2108.    Send the required number of replies back.
  2109.    We assume all fields other than the data fields are
  2110. @@ -64,7 +63,7 @@
  2111.       the empty packet */
  2112.    if(params_to_send == 0 && data_to_send == 0)
  2113.      {
  2114. -      send_smb(outbuf);
  2115. +      send_smb(Client,outbuf);
  2116.        return 0;
  2117.      }
  2118.  
  2119. @@ -131,7 +130,7 @@
  2120.             params_to_send, data_to_send, paramsize, datasize));
  2121.  
  2122.        /* Send the packet */
  2123. -      send_smb(outbuf);
  2124. +      send_smb(Client,outbuf);
  2125.  
  2126.        pp += params_sent_thistime;
  2127.        pd += data_sent_thistime;
  2128. @@ -864,7 +863,7 @@
  2129.    uint16 info_level = SVAL(params,0);
  2130.    int data_len;
  2131.    struct stat st;
  2132. -  char *sname = lp_servicename(SNUM(cnum));
  2133. +  char *vname = volume_label(SNUM(cnum));
  2134.    
  2135.    DEBUG(3,("call_trans2qfsinfo: cnum = %d, level = %d\n", cnum, info_level));
  2136.  
  2137. @@ -894,11 +893,11 @@
  2138.      case 2:
  2139.      { 
  2140.        /* Return volume name */
  2141. -      int volname_len = MIN(strlen(sname),11);
  2142. +      int volname_len = MIN(strlen(vname),11);
  2143.        data_len = l2_vol_szVolLabel + volname_len + 1;
  2144.        put_dos_date2(pdata,l2_vol_fdateCreation,st.st_ctime);
  2145.        SCVAL(pdata,l2_vol_cch,volname_len);
  2146. -      StrnCpy(pdata+l2_vol_szVolLabel,sname,volname_len);
  2147. +      StrnCpy(pdata+l2_vol_szVolLabel,vname,volname_len);
  2148.        DEBUG(5,("call_trans2qfsinfo : time = %x, namelen = %d, name = %s\n",st.st_ctime,volname_len,
  2149.             pdata+l2_vol_szVolLabel));
  2150.        break;
  2151. @@ -911,14 +910,14 @@
  2152.        PutUniCode(pdata+12,FSTYPE_STRING);
  2153.        break;
  2154.      case SMB_QUERY_FS_LABEL_INFO:
  2155. -      data_len = 4 + strlen(sname);
  2156. -      SIVAL(pdata,0,strlen(sname));
  2157. -      strcpy(pdata+4,sname);      
  2158. +      data_len = 4 + strlen(vname);
  2159. +      SIVAL(pdata,0,strlen(vname));
  2160. +      strcpy(pdata+4,vname);      
  2161.        break;
  2162.      case SMB_QUERY_FS_VOLUME_INFO:      
  2163. -      data_len = 17 + strlen(sname);
  2164. -      SIVAL(pdata,12,strlen(sname));
  2165. -      strcpy(pdata+17,sname);      
  2166. +      data_len = 17 + strlen(vname);
  2167. +      SIVAL(pdata,12,strlen(vname));
  2168. +      strcpy(pdata+17,vname);      
  2169.        break;
  2170.      case SMB_QUERY_FS_SIZE_INFO:
  2171.        {
  2172. @@ -1062,8 +1061,7 @@
  2173.        break;
  2174.  
  2175.      case 3:
  2176. -    case 4:
  2177. -      data_size = (info_level==3?24:28);
  2178. +      data_size = 24;
  2179.        put_dos_date2(pdata,0,sbuf.st_ctime);
  2180.        put_dos_date2(pdata,4,sbuf.st_atime);
  2181.        put_dos_date2(pdata,8,sbuf.st_mtime);
  2182. @@ -1072,6 +1070,11 @@
  2183.        SIVAL(pdata,20,mode);
  2184.        break;
  2185.  
  2186. +    case 4:
  2187. +      data_size = 4;
  2188. +      SIVAL(pdata,0,data_size);
  2189. +      break;
  2190. +
  2191.      case 6:
  2192.        return(ERROR(ERRDOS,ERRbadfunc)); /* os/2 needs this */      
  2193.  
  2194. @@ -1468,6 +1471,15 @@
  2195.  
  2196.  
  2197.  /****************************************************************************
  2198. +  reply to a SMBtranss2 - just ignore it!
  2199. +****************************************************************************/
  2200. +int reply_transs2(char *inbuf,char *outbuf,int length,int bufsize)
  2201. +{
  2202. +  DEBUG(4,("Ignoring transs2 of length %d\n",length));
  2203. +  return(-1);
  2204. +}
  2205. +
  2206. +/****************************************************************************
  2207.    reply to a SMBtrans2
  2208.  ****************************************************************************/
  2209.  int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize)
  2210. @@ -1524,11 +1536,11 @@
  2211.      /* We need to send an interim response then receive the rest
  2212.         of the parameter/data bytes */
  2213.        outsize = set_message(outbuf,0,0,True);
  2214. -      send_smb(outbuf);
  2215. +      send_smb(Client,outbuf);
  2216.  
  2217.        while( num_data_sofar < total_data || num_params_sofar < total_params)
  2218.      {
  2219. -      receive_smb(inbuf, 0);
  2220. +      receive_smb(Client,inbuf, 0);
  2221.        
  2222.        /* Ensure this is still a trans2 packet (sanity check) */
  2223.        if(CVAL(inbuf, smb_com) != SMBtrans2)
  2224. diff -u -r --new-file last-version/source/util.c samba-1.9.15p3/source/util.c
  2225. --- last-version/source/util.c    Tue Nov 21 12:39:49 1995
  2226. +++ samba-1.9.15p3/source/util.c    Wed Nov 22 17:14:00 1995
  2227. @@ -1940,7 +1940,7 @@
  2228.    DEBUG(6,("write_socket(%d,%d)\n",fd,len));
  2229.    ret = write_data(fd,buf,len);
  2230.        
  2231. -  DEBUG(4,("write_socket(%d,%d) gave %d\n",fd,len,ret));
  2232. +  DEBUG(6,("write_socket(%d,%d) wrote %d\n",fd,len,ret));
  2233.    return(ret);
  2234.  }
  2235.  
  2236. @@ -2493,10 +2493,9 @@
  2237.    read an smb from a fd and return it's length
  2238.  The timeout is in milli seconds
  2239.  ****************************************************************************/
  2240. -BOOL receive_smb(char *buffer,int timeout)
  2241. +BOOL receive_smb(int fd,char *buffer,int timeout)
  2242.  {
  2243.    int len;
  2244. -  int fd = Client;
  2245.    BOOL ok;
  2246.  
  2247.    bzero(buffer,smb_size + 100);
  2248. @@ -2528,9 +2527,8 @@
  2249.  /****************************************************************************
  2250.    send an smb to a fd 
  2251.  ****************************************************************************/
  2252. -BOOL send_smb(char *buffer)
  2253. +BOOL send_smb(int fd,char *buffer)
  2254.  {
  2255. -  int fd = Client;
  2256.    int len;
  2257.    int ret,nwritten=0;
  2258.    len = smb_len(buffer) + 4;
  2259. diff -u -r --new-file last-version/source/version.h samba-1.9.15p3/source/version.h
  2260. --- last-version/source/version.h    Tue Nov 21 12:52:20 1995
  2261. +++ samba-1.9.15p3/source/version.h    Wed Nov 22 22:10:03 1995
  2262. @@ -1 +1 @@
  2263. -#define VERSION "1.9.15p2"
  2264. +#define VERSION "1.9.15p3"
  2265. diff -u -r --new-file last-version/source/vt_mode.c samba-1.9.15p3/source/vt_mode.c
  2266. --- last-version/source/vt_mode.c    Tue Sep 12 16:28:49 1995
  2267. +++ samba-1.9.15p3/source/vt_mode.c    Wed Nov 22 15:01:00 1995
  2268. @@ -318,7 +318,7 @@
  2269.          OutBuf [4] = 0x06;
  2270.          _smb_setlen(OutBuf, 1);
  2271.  
  2272. -        send_smb(OutBuf);
  2273. +        send_smb(Client,OutBuf);
  2274.  
  2275.          return(0);
  2276.          break;
  2277. @@ -441,13 +441,13 @@
  2278.                  nread = VT_Input(OutBuffer, MIN(BUFFER_SIZE,lp_maxxmit()));
  2279.  
  2280.                  if(nread > 0)
  2281. -                    send_smb(OutBuffer);
  2282. +                    send_smb(Client,OutBuffer);
  2283.              }
  2284.  
  2285.              if(FD_ISSET(Client, &si)) {
  2286.                  /* got input from socket */
  2287.  
  2288. -                if(receive_smb(InBuffer, 0)) {
  2289. +                if(receive_smb(Client,InBuffer, 0)) {
  2290.                      msg_type = CVAL(InBuffer,0);
  2291.                      msg_flags = CVAL(InBuffer,1);
  2292.      
  2293. @@ -470,7 +470,7 @@
  2294.                                      nread,
  2295.                                      smb_len(OutBuffer)));
  2296.                              } else
  2297. -                                send_smb(OutBuffer);
  2298. +                                send_smb(Client,OutBuffer);
  2299.                          }
  2300.                      }
  2301.                  } else
  2302.